-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
onDestroy hook not called on SSR since version 3.39.0 in production mode #6676
Comments
Maybe related #6416 |
Lifecycle hooks should not be called during SSR/on the server, they are meant for the browser only. What's your use case for relying on them getting called on the server? I'm honestly a bit surprised, I don't think they ever were called on the server. |
I had a usecase for needing |
Interesting ... As you see I'm not that well-versed with SSR + Hooks, but if |
Should be |
@Rich-Harris @benmccann this seems to have slipped while designing the noops for SvelteKit. Is this something we need to revert or do we go "works as designed for SvelteKit"-route here and adjust the documentation? |
I'm okay to revert it. The original motivation was to not call |
This should be fixed in 3.42.3. Thanks for the speedy PR @dummdidumm! |
Describe the bug
According documentation onDestroy hook must be called on server when component is destroyed. It looks like since version 3.39.0 it never gets called.
Reproduction
Clone repo: https://github.com/cudr/svelte-onDestroy-bug-repro then install dependencies and build.
Start project
npm run start
, go to main page and check terminal output (there are no console here).If svelte is downgraded to 3.38.3 this will work fine and the onDestroy hook will be called.
Logs
No response
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: