-
-
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
pushHistory
throws an error when used inside a $effect
hook
#12248
Comments
I don't know if this can be useful, I wanted to give a shot to this but I don't really know where to put my hands on. As far as i saw I hope this can be helpful, I'm not sure if this is even the right place to write this. |
This is huge! |
A better workaround than setTimeout might be to use svelte's tick function. Seems to work for me. $effect(async () => {
await tick();
replaceState("/", {});
}) |
This happens because of our use of the legacy component wrapper, which calls The same happens if you would use onMount, and also in Svelte 4, so this is not strictly related to Svelte 5. |
Add a new option to the legacy class component interface so that `flush_sync` can be omitted. Part of sveltejs/kit#12248
* feat: allow non-synchronous legacy component instantiation Add a new option to the legacy class component interface so that `flush_sync` can be omitted. Part of sveltejs/kit#12248 * lint --------- Co-authored-by: Rich Harris <[email protected]>
Adjusts the behavior to that of the new `mount`/`hydrate` APIs and also fixes #12248
Adjusts the behavior to that of the new `mount`/`hydrate` APIs and also fixes #12248
Describe the bug
pushHistory
throws an error when used inside a$effect
hook (Logs included below)Reproduction
Link to SvelteLab repo: https://www.sveltelab.dev/0w91yk8my729dku
Logs
System Info
Severity
serious, but I can work around it
Additional Information
Workaround: put the pushState inside a setTimeout like this
vite.config.js
svelte.config.js
The text was updated successfully, but these errors were encountered: