You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the router to replace the query parameters, the page is scrolled to the top. I have created an example of this on codesandbox
In our scenario we have a listing page with a pagination button. When clicking the pagination button, new items are being loaded and rendered on screen. We store the page-number in the query parameters so we can determine how many items to load when navigating between item detail page and the listing page.
However, this PR seems to have introduced unexpected behavior to our implementation.
Is there a way to prevent the page from scrolling?
Expected Behavior
The page should not scroll.
To Reproduce
I have created a codesandbox here where you will see a list of items. All the way to the bottom of the list is a button which updates the pageNumber, and with it, the amount of items on the page.
When updating the pageNumber, the url parameters are updated through router.replace. This causes the page to scroll to the top.
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 28, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Next.js are you using?
10.0.5
What version of Node.js are you using?
12
What browser are you using?
Firefox
What operating system are you using?
Windows
How are you deploying your application?
Other platform
Describe the Bug
When using the router to replace the query parameters, the page is scrolled to the top. I have created an example of this on codesandbox
In our scenario we have a listing page with a pagination button. When clicking the pagination button, new items are being loaded and rendered on screen. We store the page-number in the query parameters so we can determine how many items to load when navigating between item detail page and the listing page.
However, this PR seems to have introduced unexpected behavior to our implementation.
Is there a way to prevent the page from scrolling?
Expected Behavior
The page should not scroll.
To Reproduce
I have created a codesandbox here where you will see a list of items. All the way to the bottom of the list is a button which updates the pageNumber, and with it, the amount of items on the page.
When updating the pageNumber, the url parameters are updated through
router.replace
. This causes the page to scroll to the top.The text was updated successfully, but these errors were encountered: