-
-
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
Broken reactivity on $page
store
#10013
Comments
$page
store$page
store
$page
store$page
store
Possibly related to #9374 |
@moonmeister Can you please recreate the repro as a plain git repo? SvelteLab neither has a download nor does it allow opening the output in a new window which makes it really difficult for us to debug. |
It happens because you're mutating the searchParams on $page.url. That corrupts the internal state of the router so when you navigate it sees that the URL is unchanged and doesn't update the page store. Create a new URL or URLSearchParams from $page.url instead of mutating it and use that in the goto. |
Confirmed, makes sense, thanks @gtm-nayan. Maybe a linter error could be written to protect against this? |
Just for info: you can both download the code and open the preview in a new window...to download the code press CMD+k and search for the download command. To open the preview in another window just click the little icon after the url bar over the preview. |
That fails after clicking |
Oh that's an issue with StackBlitz and it only happens in certain browsers. I'll investigate btw. Do you mean download/clone without accessing svelltelab? Or from the cli inside sveltelab? |
Describe the bug
I have a component that subscribes to $page.url. On that page, I change some app config that gets saved to the URL search params using
goto
from$app/navigation
. This all works great. But I'm trying to render other components using that data from the url and they don't update on changes. It seems subscriptions (auto and manual) are broken with the$page
store, or at least$page.url
.Reproduction
Svelte Lab Repl
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
I think the workaround is basically manually managing another store, annoying but possible.
The text was updated successfully, but these errors were encountered: