mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-11 12:04:21 +00:00
add scroll to top on route change
This commit is contained in:
parent
f3403b3ec1
commit
4cd670d79e
@ -156,6 +156,20 @@ function PersistentDrawerLeft({ loading, account, children, enableEthereum, loca
|
||||
const [logs, setLogs] = useState([])
|
||||
const position = useWindowScrollPosition()
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
// trying to use new API - https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
|
||||
window.scroll({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
} catch (error) {
|
||||
// just a fallback for older browsers
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
}, [pathname, search])
|
||||
|
||||
useEffect(() => {
|
||||
const queryParams = queryString.parse(search)
|
||||
if (queryParams.logs) enableLogs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user