-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Pre-rendered SPA route not re-loaded #13142
Comments
Hey @namoscato, |
@Akash187, I'm not sure that is true given SPA transitions from pre-rendered route A → pre-rendered route B work as expected.
Yeah, that's probably true, but I am trying to pre-render the route in question. |
@namoscato it will work as you think once you build it. Try building it and test. |
So should the routes define both |
This seems to be a bug. I tested your code along with mine and came to conclusion that when dynamic route changes like /1 to /2 it is not triggering navigation. To test this update your App function on root.tsx and see the console logs.
|
@namoscato Here is the solution, you are suppose to re-render the component using key prop. Below is the full App function code that fixes your issue.
|
Thanks @Akash187, but that potential workaround does not fix the issue. Even if it did, it would be undesirable – ideally the route component would just re-render with updated |
Yeah, upon refresh I see that the workaround is not working. |
Hey @brophdawg11 why route param change from Here is the updated code example for your reference https://stackblitz.com/edit/github-xpx3kyws-86ph2cy5 |
This looks like a bug around some of the new revalidation logic with export function shouldRevalidate() {
return true;
} |
I'm using React Router as a...
framework
Reproduction
/2
, but component does not re-loadSystem Info
Used Package Manager
npm
Expected Behavior
SPA transitions between the same pre-rendered route with updated params should re-invoke the route's
loader
and re-render the route component with the new loader result.Actual Behavior
While the URL updates as expected, the pre-rendered route is re-rendered with the first page's loader data.
This seems to be scoped to pre-rendered routes in SPA mode (
ssr: false
) with aloader
function, and it seemed to regress around v7.2.0.The text was updated successfully, but these errors were encountered: