From f317739abfb714f13523728d9f643a654fe60c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramirez=20Vargas=2C=20Jos=C3=A9=20Pablo?= Date: Sun, 7 Sep 2025 14:56:42 -0600 Subject: [PATCH] fix: Snapshot state data when using it to preserve state in external navigation --- src/lib/core/LocationLite.svelte.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core/LocationLite.svelte.ts b/src/lib/core/LocationLite.svelte.ts index 67436b8..c961e71 100644 --- a/src/lib/core/LocationLite.svelte.ts +++ b/src/lib/core/LocationLite.svelte.ts @@ -46,7 +46,7 @@ export class LocationLite implements Location { this.#innerState.url.href = globalThis.window?.location?.href; if (!globalThis.window?.history?.state) { // Potential hash navigation. Preserve current state. - this.#goTo(this.#innerState.url.href, true, this.#innerState.state); + this.#goTo(this.#innerState.url.href, true, $state.snapshot(this.#innerState.state)); } this.#innerState.state = globalThis.window?.history?.state ?? this.#innerState.state; }));