From 84c923e82e7920982a408703a624f5a9875dc656 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 28 Sep 2023 15:01:45 +0200 Subject: [PATCH] fix: missing dependency in useCallback --- src/hooks/use-track-changes.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hooks/use-track-changes.ts b/src/hooks/use-track-changes.ts index 03be5a5b3..6333098c1 100644 --- a/src/hooks/use-track-changes.ts +++ b/src/hooks/use-track-changes.ts @@ -27,6 +27,11 @@ export function useTrackChanges(enabled: boolean, getData: getDataType) { [enabledRef, changedVariables] ); + // Reset list of changed variables + const resetChangedData = useCallback(() => { + changedVariables.current.clear(); + }, [changedVariables]); + const getChangedData = useCallback( (reset: boolean = false) => { if (!enabledRef.current) { @@ -43,14 +48,9 @@ export function useTrackChanges(enabled: boolean, getData: getDataType) { } return data; }, - [enabledRef, getDataRef] + [enabledRef, getDataRef, resetChangedData] ); - // Reset list of changed variables - const resetChangedData = useCallback(() => { - changedVariables.current.clear(); - }, [changedVariables]); - return { addChange, getChangedData,