Skip to content

Commit 32adc9a

Browse files
committed
fix(ktl-4093): removed savedHash after it used
1 parent 7c518b2 commit 32adc9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hooks/useDeferredAnchorScroll.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react';
22

33
// Strip the hash early (module-level, runs before any render/scroll)
44
// so the browser doesn't attempt its native scroll-to-anchor.
5-
const savedHash =
5+
let savedHash =
66
typeof window !== 'undefined' && window.location.hash ? window.location.hash : '';
77
if (savedHash) {
88
history.replaceState(null, '', window.location.pathname + window.location.search);
@@ -24,6 +24,7 @@ export function useDeferredAnchorScroll(isLayoutReady: boolean) {
2424

2525
// Restore the hash silently (without triggering the browser scroll)
2626
history.replaceState(null, '', savedHash);
27+
savedHash = '';
2728
markTargetElement();
2829
scrollToTargetElement();
2930
hasScrolledToAnchor.current = true;

0 commit comments

Comments
 (0)