mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
fix: reset scroll to top when navigating to profile pages
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user