From 1da83544bfe24b5ef57ce249d60a5ce3bf8b92aa Mon Sep 17 00:00:00 2001 From: "thai.ly" Date: Mon, 16 Dec 2024 12:36:06 +0700 Subject: [PATCH] fix: add dependency highlights in function callback scrollToHighlightFromHash --- example/src/App.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index 2b4c32b75..d6c8a7fef 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -69,12 +69,13 @@ export function App() { const scrollViewerTo = useRef((highlight: IHighlight) => {}); + // biome-ignore lint/correctness/useExhaustiveDependencies(a): const scrollToHighlightFromHash = useCallback(() => { const highlight = getHighlightById(parseIdFromHash()); if (highlight) { scrollViewerTo.current(highlight); } - }, []); + }, [highlights]); useEffect(() => { window.addEventListener("hashchange", scrollToHighlightFromHash, false);