Open aloisklink opened 2 weeks ago
I can't seem to reproduce the issue. After refreshing the page, the setTimeout
prevents the page from loading immediately, and if I click the back button, it shows the Home page without any errors.
I can't seem to reproduce the issue. After refreshing the page, the setTimeout prevents the page from loading immediately, and if I click the back button, it shows the Home page without any errors.
Ah, that's my fault (it's my first time using Stackblitz)! For some reason, the Stackblitz had export const ssr = true;
, and this bug only happens when SSR is disabled (maybe I was testing this previously, and I accidentally saved it).
Please try again (and if you still see export const ssr = true;
, try disabling it)!
Describe the bug
When loading a non-SSR page and pressing the browser's back button while the page is still loading, it's possible for
current.url
to still be the default value ofnull
, which then causes thepopState
function to throw the following uncaught error:The error is from
current.url
beingnull
in: https://github.com/sveltejs/kit/blob/e41a8e24b71cb9e9ee249ddfe732a3d0721d40bf/packages/kit/src/runtime/client/client.js#L2234, and seems to be have been introduced in https://github.com/sveltejs/kit/commit/aabe33c4f6097503c7dabf8a5b9a8a566981da2aI've got a PR pending for this, but I'm not 100% on my fix, so I thought I'd make an issue just to be sure!
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-51wzhl?file=README.md
If I go to the
/about
page, which has contents:If I then refresh the page, then press the Back button on my mouse before it's finished loading the PageData, nothing happens (other than seeing the error in the console):
Screencast from 2024-10-31 20-45-32.webm
Logs
System Info
Severity
annoyance
Additional Information
This is pretty minor, but I've got @getsentry setup on a SvelteKit site, and I'm noticing that it's happening quite a bit.