Incorrect information in the docs about client side router cache? #81081
-
In the caching guide it says:
But I am pretty sure if I visit a client component then navigate to a different URL, current component gets unmounted, hence state won't be preserved. What am I missing? Here is also demo:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Uh that's a loaded line if I ever seen one ~ Yes, as of today, state at Formally speaking it should be shared layouts - I think - I don't remember right now if Parallel routes have some game here, they can also have layouts too, so I guess, shared layouts still applies ~ And I say of today because the React Activity, challenges that :) https://react.dev/reference/react/Activity#noun-labs-1201738-(2) |
Beta Was this translation helpful? Give feedback.
Uh that's a loaded line if I ever seen one ~
Yes, as of today, state at
app/foo/bar/page.js
will get lost when you go toapp/foo/bazz/page.js
- however, if you have state at the root layout, through an imported Client Component, or even atapp/foo/layout.js
- that state will be preserved.Formally speaking it should be shared layouts - I think - I don't remember right now if Parallel routes have some game here, they can also have layouts too, so I guess, shared layouts still applies ~
And I say of today because the React Activity, …