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,