import { UseFormReturn, useWatch } from 'react-hook-form' import { FormField, SheetSection } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { CreateCronJobForm } from './CreateCronJobSheet/CreateCronJobSheet.constants' import FunctionSelector from '@/components/ui/FunctionSelector' import { SchemaSelector } from '@/components/ui/SchemaSelector' interface SqlFunctionSectionProps { form: UseFormReturn } export const SqlFunctionSection = ({ form }: SqlFunctionSectionProps) => { const schema = useWatch({ control: form.control, name: 'values.schema' }) return ( ( { field.onChange(name) // deselect the selected function when the schema is changed form.resetField('values.functionName') }} /> )} /> ( field.onChange(name)} /> )} /> ) }