Skip to content

fix: fix popState race-condition when not using SSR #12925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-months-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: fix race-condition when not using SSR when pressing back before initial load
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ function _start_router() {
const state = event.state[STATES_KEY] ?? {};
const url = new URL(event.state[PAGE_URL_KEY] ?? location.href);
const navigation_index = event.state[NAVIGATION_INDEX];
const is_hash_change = strip_hash(location) === strip_hash(current.url);
const is_hash_change = current.url ? strip_hash(location) === strip_hash(current.url) : false;
const shallow =
navigation_index === current_navigation_index && (has_navigated || is_hash_change);

Expand Down
Loading