From 6a9957e84964018baf095baeee36558815a92de5 Mon Sep 17 00:00:00 2001 From: terronator Date: Thu, 2 May 2024 15:20:26 +0200 Subject: [PATCH] fix: refresh callback declaration fix in useNavScroll Co-authored-by: Nicola Alessandro Domingo --- src/NavScroll/useNavScroll.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/NavScroll/useNavScroll.ts b/src/NavScroll/useNavScroll.ts index 6b248922f..e5394882c 100644 --- a/src/NavScroll/useNavScroll.ts +++ b/src/NavScroll/useNavScroll.ts @@ -122,12 +122,11 @@ export function useNavScroll(args: useNavScrollArgs = {}): useNavScrollResult { forceRecompute ]); - const refresh = useCallback( + const refresh = useCallback(() => { debounce(() => { setCounter(counter + 1); - }, REGISTER_DELAY), - [counter] - ); + }, REGISTER_DELAY); + }, [counter]); const register = useCallback( (id, options = {}) => {