You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a route that when it is mounted it modifies some state and immediately redirects using goto. As result this route does not contain any html, it is purely for redirecting to the next page on the client.
The issue is that the code on the redirect page does not get torn down properly after the redirect, and as result can modify the state even though it is not active.
This only occurs in the built version and not the dev version.
Interestingly it only seems to remain active "once", in that if a store changes for a second time nothing will happen.
Man, this was a good old-fashioned bug hunt the likes of which I haven't been on for a while. Turns out it's a bug in Svelte itself — I've opened an issue over there, so we can close this one. Thanks! sveltejs/svelte#7488
Describe the bug
I have a route that when it is mounted it modifies some state and immediately redirects using
goto
. As result this route does not contain any html, it is purely for redirecting to the next page on the client.The issue is that the code on the redirect page does not get torn down properly after the redirect, and as result can modify the state even though it is not active.
This only occurs in the built version and not the dev version.
Interestingly it only seems to remain active "once", in that if a store changes for a second time nothing will happen.
Reproduction
https://github.com/OliverHGray/sveltekit-empty-route-issue
To reproduce:
npm i
npm run build
npm run preview
localhost:3000
page2
)Expected: Nothing is printed in the console as all
page2
does is update the storeActual: The updated string is printed in the console as the code from the
index
route is still active.Logs
No response
System Info
Don't think this is applicable as this issue happens if I build it locally or on GHA and running on all browsers I've tested it on.
Severity
annoyance
Additional Information
Just an annoyance, as I say adding some dummy content to the page will fix it.
Also would like to say this bug took absolutely forever to find!
The text was updated successfully, but these errors were encountered: