diff --git a/packages/hooks/src/createDeepCompareEffect/index.ts b/packages/hooks/src/createDeepCompareEffect/index.ts index eefdd6b39b..5bbaff74ed 100644 --- a/packages/hooks/src/createDeepCompareEffect/index.ts +++ b/packages/hooks/src/createDeepCompareEffect/index.ts @@ -10,9 +10,9 @@ export const createDeepCompareEffect: CreateUpdateEffect = (hook) => (effect, de const signalRef = useRef(0); if (deps === undefined || !depsEqual(deps, ref.current)) { - ref.current = deps; signalRef.current += 1; } + ref.current = deps; hook(effect, [signalRef.current]); }; diff --git a/packages/hooks/src/utils/useDeepCompareWithTarget.ts b/packages/hooks/src/utils/useDeepCompareWithTarget.ts index 89d685b4dd..2c84ff4e96 100644 --- a/packages/hooks/src/utils/useDeepCompareWithTarget.ts +++ b/packages/hooks/src/utils/useDeepCompareWithTarget.ts @@ -13,9 +13,9 @@ const useDeepCompareEffectWithTarget = ( const signalRef = useRef(0); if (!depsEqual(deps, ref.current)) { - ref.current = deps; signalRef.current += 1; } + ref.current = deps; useEffectWithTarget(effect, [signalRef.current], target); };