- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix scroll restoration #3191
Conversation
View your CI Pipeline Execution ↗ for commit a40e193.
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/create-router
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-cross-context
@tanstack/create-start
@tanstack/react-router
@tanstack/react-router-with-query
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/start
@tanstack/start-api-routes
@tanstack/start-client
@tanstack/start-config
@tanstack/start-plugin
@tanstack/start-router-manifest
@tanstack/start-server
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-handler
@tanstack/start-server-functions-server
@tanstack/start-server-functions-ssr
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
67f86d1
to
cb748b9
Compare
0330b37
to
bda0550
Compare
I found this change broke native browser scroll restoration in our app. This is because |
It’s called because it also handles hash scrolling. The actual restoration logic internally only runs if it’s turned on. |
Thanks for your response! Much appreciated. I guess the issue is: if no restoration happens, the page is scrolled to the top. See:
This counteracts native scroll restoration. And it seems to be different behaviour than before this PR. Ideally I'd like a way to opt out of that altogether. Also OK if it means opting out of hash scrolling. I'd be happy to create a PR for it. But of course only if you agree this is a valid option to provide. And what exactly the option should do – opt out of hash scrolling as well? or only opt out of the default scrolling to the top in case there is nothing to do? |
This release also broke the scroll restoration in my app. After 30 minutes of reading the docs and trying to figure out how to have my app (with simple use cases) support the new version, I haven't succeeded. So I'm either thick or the documentation is not clear about this. Which is unlike the tanstack suite, so I'm guessing it's me. I'm reverting back to the old version for now. Reluctantly, but will have to do it to move forward. |
Would you have time to jump on a call soon to debug with me? |
Dm me in discord. |
For @mihkelmark or others in this thread; the reason things worked with native scroll restoration in the past was more or less accidental. Architectural changes in @tanstack/react-router after 1.98 require scroll restoration to be configured. In my case this was a matter of adding:
And in the virtualized tables in our application:
That is all! Returning |
@rolftimmermans we should add the window part to the docs ! |
Sure! #3752 |
Based on #3191 (comment)
No description provided.