-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent navigation when preloading fails due to network error (#…
…11944) fixes #9508 Adds a preload tokens set, which is updated with the corresponding pending preloads. This set is checked when an error occurs during a navigation to check if this is a preload navigation, and if yes, don't trigger the error --------- Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
- Loading branch information
1 parent
b94010d
commit 4562275
Showing
8 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@sveltejs/kit": patch | ||
--- | ||
|
||
fix: prevent navigation when `data-sveltekit-preload-data` fails to fetch due to network error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...ges/kit/test/apps/basics/src/routes/data-sveltekit/preload-data/offline/+layout.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function load({ url }) { | ||
return { | ||
url: url.toString() | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/kit/test/apps/basics/src/routes/data-sveltekit/preload-data/offline/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<a id="one" href="/data-sveltekit/preload-data/offline/target" data-sveltekit-preload-data>target</a | ||
> | ||
|
||
<a | ||
id="slow-navigation" | ||
href="/data-sveltekit/preload-data/offline/slow-navigation" | ||
data-sveltekit-preload-data>slow-navigation</a | ||
> |
5 changes: 5 additions & 0 deletions
5
...pps/basics/src/routes/data-sveltekit/preload-data/offline/slow-navigation/+page.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export async function load() { | ||
return new Promise((resolve) => { | ||
setTimeout(resolve, 1000); | ||
}); | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters