-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
page.params from $app/state is not reactive where as from $app/stores is reactive #13305
Comments
This does work when using svelte5
And this works too:
But why won't it work using |
$.legacy_pre_effect(() => (page), () => {
$.set(fooId, page.params.fooId);
}); (If you force runes mode via
|
That makes sense, thank you. Would it be worthwhile to update the sveltekit $app/state/page documentation to give some examples of how it should be used differently compared to $app/stores/page? https://svelte.dev/docs/kit/$app-state#page Another question, I see that that $app/stores/page is deprecated. This would have the effect of encouraging us to move to Svelte5 style runes. Is svelte planning on getting rid of the legacy $ reactivity? If so then the deprecation of $app/stores/page makes sense. But if not, then perhaps $app/stores/page should not be deprecated? |
Possibly.
Yes, it will eventually be removed in some later major version of Svelte. |
Would heartily endorse it if at all possible! I'm new to svelte and updating a page based on URL params is the first interesting thing I've tried to do. I've spent many hours trying to figure out why the most basic thing isn't working. I suspect this is a thing on the critical path for beginners and some docs here would have high ROI. |
Describe the bug
I apologize if this is something simple, I have read the documentation on $app/state/page and believe that this should work the same as it does for $app/stores/state but it does not.
It seems that $app/state/page lacks the reactivity that $app/stores/page has.
Clicking on the link here will no longer cause the page.params.fooId to change. The URL is correctly updated when clicking on the link, but $fooId = page.params.fooId does not react.
This works works fine when using { page } from '$app/stores':
Reproduction
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: