-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Navigating from /a to /b in route /[route] reruns +page.ts but +page.svelte is unchanged #15918
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
Comments
Switching to another page that's rendered by the same component updates the props passed to that component - it doesn't re-render the whole component. |
I've added a derived variable as I've understood your suggestion, but the ui still doesn't update. Example repo updated with this change. |
Just to elaborate, my understanding is that derived variables must be based on reactive ($state()) variables, and since the values passed down from the pageLoad are not reactive we cannot use them for $derived. |
It should be like this: const { data } = $props();
- const { stage } = data;
+ const { stage } = $derived(data); Also, it should be noted that |
Okay thank you, that works. It's very nuanced though, and I think it should
be documented specifically somewhere at
https://svelte.dev/docs/kit/load#Page-data
…On Thu, May 15, 2025 at 11:40 AM 7nik ***@***.***> wrote:
*7nik* left a comment (sveltejs/svelte#15918)
<#15918 (comment)>
It should be like this:
const { data } = $props();- const { stage } = data;+ const { stage } = $derived(data);
Also, it should be noted that stage, in case it's an object, isn't deeply
reactive.
—
Reply to this email directly, view it on GitHub
<#15918 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACH3QI2FQWBZ5ZCOKX2N4JD26ROIFAVCNFSM6AAAAAB5EKL5MKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOBTGE4TSNZSHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Describe the bug
If I have a route like /[slug], and I go to /a, the page load function picks up 'a' from params, does what it needs and passes the data down to +page.svelte as expected. Then if I then navigate from /a to /b, the page load function reruns, provides new data down to +page.svelte, but the ui does not update. I can't find anything in the docs to describe what to do to get the ui to update with the new data.
Reproduction
https://github.com/ianengelbrecht/sveltekit-pagenavs
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: