Skip to content

Commit

Permalink
fix: automatically scroll to top on page change (#1656)
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy authored Oct 30, 2023
1 parent 236a03a commit 79632f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App/Router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { routes } from 'constants/routing';
import { useAuth } from 'context/AuthContext';

import PageSuspense from './PageSuspense';
import { PAGE_CONTAINER_ID } from 'constants/layout';

const Dashboard = lazy(() => import('pages/Dashboard'));
const Account = lazy(() => import('pages/Account'));
Expand All @@ -31,7 +32,7 @@ const Router = () => {

// Scroll to the top of the page on route change
useEffect(() => {
window.scrollTo(0, 0);
document.getElementById(PAGE_CONTAINER_ID)?.scrollTo(0, 0);
}, [location]);

// Redirect to account page if user has already connected their wallet and is
Expand Down

0 comments on commit 79632f7

Please sign in to comment.