kit: 4.2.7: Browser back button does not go back (url changes but page does not change)
Describe the bug
On some pages when i click the browser back button the url changes but the page does not. This behaviour is intermittent which is even more strange. There are no errors being thrown in the browser or terminal.
Please see my screen recording below.
Reproduction
Its hard to give a repoduction on this when im not sure how it is happening
Logs
There are no errors or logs
System Info
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 15.23 GB / 31.92 GB
Binaries:
Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.6.3 - ~\AppData\Local\pnpm\pnpm.EXE
Browsers:
Edge: Chromium (121.0.2277.128)
Internet Explorer: 11.0.19041.3636
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.0.1
@sveltejs/kit: ^2.0.0 => 2.0.6
@sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.1
svelte: ^4.2.7 => 4.2.8
vite: ^5.0.3 => 5.0.10
Severity
blocking an upgrade
Additional Information
Video recording of issue: https://github.com/sveltejs/kit/assets/57114335/d94ed7cb-2f50-439c-a953-68ade1bcca3f
About this issue
- Original URL
- State: open
- Created 4 months ago
- Comments: 16 (3 by maintainers)
Please provide a minimal repository that shows how you are using the replaceState and pushState functions so that we can see exactly what error it throws.
Can confirm, same problem with pushState too
I will need to try solved the issue and see where it is coming from. When I do that I will post here.
I observe very issue when have NordPass extension enabled. Then following simple scenario happen on every Sveltekit based site eg
I’ve just bumped into this same behavior.
I can click through links and it works fine, clicking back will go back one page, then clicking any combination of forward/backward just updates the url and not the page content. I can then click a link on my page to go to another page and then I can click back and it works for one page and then repeats the same issue. No errors are shown from vite or the browser. Attached is a demo, sorry for the glitching graphics.
Note that
beforeNavigate
andonNavigate
are also never called when it fails navigating between history states.https://github.com/sveltejs/kit/assets/9443133/b648bcec-e69d-4daa-a62f-710d4af525b6