Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

395 B
Raw Blame
import { useEffect } from 'react';
import { UseFormReturn, useWatch } from 'react-hook-form';

export function useFormChangeCallback(
  form: UseFormReturn<any>,
  onValuesChange?: (values: any) => void,
) {
  const values = useWatch({ control: form.control });

  useEffect(() => {
    if (onValuesChange) {
      onValuesChange(form.getValues());
    }
  }, [form, onValuesChange, values]);
}