fix: discard preload fork before creating a new one (#14865)
authorRich Harris <richard.a.harris@gmail.com>
Thu, 30 Oct 2025 22:50:02 +0000 (23:50 +0100)
committerGitHub <noreply@github.com>
Thu, 30 Oct 2025 22:50:02 +0000 (23:50 +0100)
* fix: discard preload fork before creating a new one

* tidy up

.changeset/shy-clocks-smoke.md [new file with mode: 0644]
packages/kit/src/runtime/client/client.js

diff --git a/.changeset/shy-clocks-smoke.md b/.changeset/shy-clocks-smoke.md
new file mode 100644 (file)
index 0000000..2c881c8
--- /dev/null
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: discard preload fork before creating a new one
index 673ff671270f0a0c7467ce9c376f8e378ab56e58..b04664ddc578985644189d444057dad0ed99fe22 100644 (file)
@@ -514,6 +514,8 @@ async function _preload_data(intent) {
        // then a later one is becoming the real navigation and the preload tokens
        // get out of sync.
        if (intent.id !== load_cache?.id) {
+               discard_load_cache();
+
                const preload = {};
                preload_tokens.add(preload);
                load_cache = {