Skip to content

Commit

Permalink
fix: missing dependency in useCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Oct 4, 2023
1 parent 3e99794 commit 84c923e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hooks/use-track-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 84c923e

Please sign in to comment.