Describe the bug
I updated my svelte project to 5.54.1 and encounterend an bug where, when I navigate by using goto, my old page is still shown above the page I navigated to. When I reload the page, it only shows the page I navigated to as expected.
I was able to pin down the behavior change to version 5.53.13 . With 5.53.12 it still works as expected.
While creating the reproductive example I learned that the bug only appears if the new page I navigate to has a new layout.
One possible workaround is to wrap the @render children in the root layout with {#key page.url.pathname}
Reproduction
I used the svelte cli tool to create a new repo, updated the svelte version to the latest available and created a page structure with a root layout, a simple page navigating to an other page which has a new layout definition. You can find this reproduction repo here: https://github.com/Nicklas2751/svelte-goto-navigation-bug
The original repo where I first encountered this bug is open source too, you can find it here: https://github.com/Nicklas2751/LibreHousehold
Logs
Browser log:
` ` `
[vite] connecting...
client:827 [vite] connected.
+page.svelte:6 Checking stuff..
` ` `
Svelte dev log:
` ` `
~/git/svelte-goto-navigation-bug main npm run dev ✔
> svelte-goto-navigation-bug@0.0.1 dev
> vite dev
VITE v7.3.1 ready in 540 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
Google Chrome is requesting /.well-known/appspecific/com.chrome.devtools.json to automatically configure devtools project settings. To learn why, and how to prevent this message, see https://svelte.dev/docs/cli/devtools-json
19:44:35 [vite-plugin-svelte] src/routes/setup/+page.svelte:15:8 Using `on:click` to listen to the click event is deprecated. Use the event attribute `onclick` instead
https://svelte.dev/e/event_directive_deprecated
` ` `
System Info
System:
OS: Linux 6.18 Manjaro Linux
CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 13.15 GB / 30.46 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.20.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 11.10.0 - /usr/bin/npm
Browsers:
Firefox: 148.0.2
Firefox Developer Edition: 148.0.2
npmPackages:
svelte: ^5.54.1 => 5.54.1
The browser from the envinfo is wrong, I am using vivaldi 7.9.3970.41 (Offizieller Build) (64-Bit) wich uses chromium version 146.0.7680.158
Severity
annoyance
Describe the bug
I updated my svelte project to 5.54.1 and encounterend an bug where, when I navigate by using
goto, my old page is still shown above the page I navigated to. When I reload the page, it only shows the page I navigated to as expected.I was able to pin down the behavior change to version
5.53.13. With5.53.12it still works as expected.While creating the reproductive example I learned that the bug only appears if the new page I navigate to has a new layout.
One possible workaround is to wrap the
@render childrenin the root layout with{#key page.url.pathname}Reproduction
I used the svelte cli tool to create a new repo, updated the svelte version to the latest available and created a page structure with a root layout, a simple page navigating to an other page which has a new layout definition. You can find this reproduction repo here: https://github.com/Nicklas2751/svelte-goto-navigation-bug
The original repo where I first encountered this bug is open source too, you can find it here: https://github.com/Nicklas2751/LibreHousehold
Logs
System Info
System: OS: Linux 6.18 Manjaro Linux CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor Memory: 13.15 GB / 30.46 GB Container: Yes Shell: 5.9 - /bin/zsh Binaries: Node: 20.20.0 - /usr/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 11.10.0 - /usr/bin/npm Browsers: Firefox: 148.0.2 Firefox Developer Edition: 148.0.2 npmPackages: svelte: ^5.54.1 => 5.54.1 The browser from the envinfo is wrong, I am using vivaldi 7.9.3970.41 (Offizieller Build) (64-Bit) wich uses chromium version 146.0.7680.158Severity
annoyance