Closed PatrickG closed 9 months ago
Is this still an issue for you? I'm experiencing something similar testing out Svelte 5 with a SvelteKit project. When Subscribing to the built-in Page, Error, or Navigating stores, I get their initial state in the subscribe
callback, but never any subsequent updates - e.g., using the auto-subscription syntax to get the current $page.url.pathname
just returns the pathname from the initially-loaded route and never updates.
Describe the bug
I'm not sure if this is a Svelte5 bug or a Svelte5 specific Sveltekit bug. But I was not able to reproduce it in the Svelte5 repl.
Reproduction
Svelte 5 (Same example with Svelte 4 is working)
Click the "Toggle" Button. The slotted content changes from
+error.svelte
to+page.svelte
correctly, but the 3 lines above the button stay the same. In the console, you can see something like:update {something: true, somethingShouldBe: false}
something
is a derived state from$page.status === 401 || $page.url.pathname === '/test'
whilesomethingShouldBe
is the exact same condition but inlined in the$inspect
rune.Strange thing is, if you change
throw401
to initially betrue
inroutes/+page.server.js
, it works correctly. Or when you change all$page.status === 401 || $page.url.pathname === '/test'
conditions to$page.status === 401
inroutes/+layout.svelte
, it works correctly as well.Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response