diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form_data.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form_data.ts index 811474d7ac6f6..fb4a0984438ad 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form_data.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form_data.ts @@ -52,13 +52,9 @@ export const useFormData = (options: Options = {}): const isMounted = useRef(false); const [formData, setFormData] = useState(previousRawData.current); - // Create a new instance of the "formatFormData()" handler whenever the "formData" state changes - // so the consumer can interchangeably declare the "formData" state or the "format()" handler as - // dependency in his useEffect(). - // This is the reason why we disable the react-hooks/exhaustive-deps rule const formatFormData = useCallback(() => { return getFormData({ unflatten: true }); - }, [formData, getFormData]); // eslint-disable-line react-hooks/exhaustive-deps + }, [getFormData]); useEffect(() => { const subscription = getFormData$().subscribe((raw) => {