Page scrolling back to top on router.replace(newUrlWithQueryParam, { scroll: false })
Unanswered
Connorcon2020 posted this in #help-forum
Technical Specifications:
- Expected Behavior Version:
- Unexpected Behavior Version:
- Using
I have used
Is this a new bug introduced that will be fixed or is there a solution in place to ensure it doesn't scroll back to the top of the screen without directly altering the path via the window, as ideally I'd like to maintain using next router to keep a stack trace of the route.
- Expected Behavior Version:
15.5.1-canary.3- Unexpected Behavior Version:
15.5.1-canary.4- Using
App RouterI have used
router.replace(newUrlWithQueryParam, { scroll: false }) to update query parameters to maintain page scroll, but starting in 15.5.1-canary.4 it now has started snapping to the top of the page. One thing I have noticed is this only seems to happen on a page containing a loading.tsx, other than that I haven't noticed a pattern on why it happens in some places and not others.Is this a new bug introduced that will be fixed or is there a solution in place to ensure it doesn't scroll back to the top of the screen without directly altering the path via the window, as ideally I'd like to maintain using next router to keep a stack trace of the route.
3 Replies
Yes it still doesn’t work, haven’t tried in v16 yet
interesting. i am using the same technique in my app but i dont have loading.tsx and it is working nicely