Closed cpakken closed 2 weeks ago
Maybe same error as https://github.com/TanStack/router/issues/1604
@cpakken I tried out your setup on 1.32.16 and either the issue has been fixed or I'm simply not seeing the issue.
https://github.com/TanStack/router/assets/33615041/c40cfca2-e9d8-4aea-8920-578b6b932c72
https://stackblitz.com/edit/github-5eojgx?file=src%2Fmain.tsx
If the issue still persists, you'll need to detail the exact steps needed to be taken to recreate scenario.
Eg:
Describe the bug
Layout Route Contexts NOT being set on non-initial redirects in beforeLoad()
Repo reproduction https://github.com/cpakken/issue-tanstack-router-layout-route-context
"@tanstack/react-router": "^1.32.13",
On non-initial loads, when a _layout route's beforeLoads() is triggered by navigation, router.invalidate(), the route's contex returns
undefined
Please run
vite dev
and use Auth Dev Controls to toggle auth state changes and observe the _LAYOUT/context returnsundefined
Note:
No context in _auth
root has context
Your Example Website or App
https://github.com/cpakken/issue-tanstack-router-layout-route-context
Steps to Reproduce the Bug or Issue
See readme.
Expected behavior
Route.useRouteContext() should return the context instead of undefined on non-initial redirects
Screenshots or Videos
No response
Platform
Additional context
No response