From a58f00bd101a5d49fa15ee8f5867b69c0e8ddffd Mon Sep 17 00:00:00 2001 From: Anthony D'Andrea Date: Thu, 7 Nov 2024 04:46:46 -0600 Subject: [PATCH] [@mantine/form] Add useCallback wrapper to `form.resetDirty` (#7029) --- .../form/src/hooks/use-form-status/use-form-status.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@mantine/form/src/hooks/use-form-status/use-form-status.ts b/packages/@mantine/form/src/hooks/use-form-status/use-form-status.ts index 88423549bd3..81c6c1d1d36 100644 --- a/packages/@mantine/form/src/hooks/use-form-status/use-form-status.ts +++ b/packages/@mantine/form/src/hooks/use-form-status/use-form-status.ts @@ -79,13 +79,13 @@ export function useFormStatus>({ const resetTouched: ResetStatus = useCallback(() => setTouched({}), []); - const resetDirty: ResetDirty = (values) => { + const resetDirty: ResetDirty = useCallback((values) => { const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current; $values.setValuesSnapshot(newSnapshot); setDirty({}); - }; + }, []); const setFieldTouched: SetFieldTouched = useCallback((path, touched) => { setTouched((currentTouched) => {