-
-
Notifications
You must be signed in to change notification settings - Fork 705
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
Route context not updated if new context is returned in beforeLoad #3051
Comments
can your create a minimal failing unit test case as a PR? still not fully understanding what's going on here |
beforeLoad used to be called with match.routeContext: router/packages/react-router/src/router.ts Line 1920 in da9d52a
but there is no routeContext since https://github.com/TanStack/router/pull/2104/files |
beforeLoad is called with the parent still don't understand how that was different or what you need here. |
https://github.com/user-attachments/assets/b57854e5-2b6f-4b54-92dd-edf2971624cc |
which i guess is a different value than routeContext from 1.45.4?
|
Which project does this relate to?
Router
Describe the bug
while updating from 1.45.4 to 1.91.3 i noticed a new behavior related to router context.
if a new context value is returned from beforeLoad it remains cached and new values for that same context key are not received.
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-hsasr5ei?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
click "refresh" button ONCE
auth.token and _auth.token have the same value
click "refresh" button again
auth.token and _auth.token have different values
remove the return statement from the indexRoute's beforeLoad
refresh the app and do 1. 2. & 3.
the behavior is different. auth.token and _auth.token have the same value at all times
Expected behavior
each call to beforeLoad should receive the latest context even if some of the keys ware overridden by beforeLoad result in the previous call. this used to be the case in 1.45.4
Screenshots or Videos
Screen.Recording.2024-12-20.at.20.22.34.mov
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: