Closed PR4SAN closed 2 weeks ago
could you please provide this as a complete example on stackblitz (e.g. by forking one of the existing examples)?
https://stackblitz.com/~/github.com/PR4SAN/tanstack-router
i have tried to make a version of my project removing all the details.
let me know if additional details needed.
This one from documentation where i modified some routes and some implementation to have data fetched as async and this works fine. if i am logged in and i navigate to login it redirects me to dashboard and and vice versa. https://codesandbox.io/p/devbox/elastic-bessie-thrywl?file=%2Fsrc%2Fauth.tsx%3A8%2C3-8%2C9
which steps are required to reproduce?
please also update to the latest @tanstack/react-router
version to check if the issue still exists there
I think we ran into the same bug, I made a repo that reproduces it: https://github.com/cpakken/issue-tanstack-router-layout-route-context
which steps are required to reproduce?
please also update to the latest
@tanstack/react-router
version to check if the issue still exists there
I have checked with updating the version didn't fix the issue in my project. i have updated it in stackblitz example as well.
I think we ran into the same bug, I made a repo that reproduces it: https://github.com/cpakken/issue-tanstack-router-layout-route-context
1618
yes this is the same issue I am facing as well.
@tannerlinsley just released v1.32.16 30 minutes ago and fixes #1618 issue. Please check if this issue is resolved
@PR4SAN The issue you are facing is because your router context is not being updated after the useQuery has finished its fetch.
You can either:
router.invalidate()
after fetching<RouterProvider />
until the fetch has completed (like in image below).You may also want to check out the authenticated routes example, where their concepts are put to use. Just remember, that you need to take the concepts and adapt it to work with your auth flow. Auth is not static, with every project implementing it just a little bit different from the next. https://tanstack.com/router/latest/docs/framework/react/examples/authenticated-routes
Thanks. Invalidating the router and updating it to the latest version fixed my issue. Also, I noticed the example in the doc is updated. Thanks
Describe the bug
Followed the same example of the protected route from the documentation.
Your Example Website or App
na
Steps to Reproduce the Bug or Issue
followed the same protected route example from doc but the context value for router is not getting updated
Expected behavior
context value should get updated.
Screenshots or Videos
No response
Platform
Additional context
No response