Open lts20050703 opened 1 month ago
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 root
is assigned in kit/src/runtime/client/client.js:434 in initialize
function, but the effect is executed during the creation of root
by sveltejs/svelte/blob/main/packages/svelte/src/internal/client/runtime.js:542, so everything that is called during $effect
that uses root
, such as pushState or replaceState, will throw an Error, as root is not yet assigned.
I hope this can be helpful, I'm not sure if this is even the right place to write this.
This is huge!
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