fix: reset scroll to top when navigating to profile pages

This commit is contained in:
Gigi
2025-11-01 10:23:27 +01:00
parent aec2dcb75c
commit 4ec34a0379

View File

@@ -100,6 +100,17 @@ const Bookmarks: React.FC<BookmarksProps> = ({
previousLocationRef.current = location.pathname
}
}, [location.pathname, showSettings, showMe, showExplore, showProfile])
// Reset scroll to top when navigating to profile routes
useEffect(() => {
if (showProfile) {
// Reset scroll position when navigating to profile pages
// Use requestAnimationFrame to ensure it happens after DOM updates
requestAnimationFrame(() => {
window.scrollTo({ top: 0, behavior: 'instant' })
})
}
}, [location.pathname, showProfile])
const activeAccount = Hooks.useActiveAccount()
const accountManager = Hooks.useAccountManager()