-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent stale values after invalidation (#11870)
- Loading branch information
1 parent
654b73e
commit 75e1f5f
Showing
6 changed files
with
81 additions
and
12 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 stale values after invalidation |
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
7 changes: 7 additions & 0 deletions
7
.../kit/test/apps/basics/src/routes/load/invalidation/invalidate-then-goto/+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,7 @@ | ||
/** @type {import('./$types').LayoutServerLoad} */ | ||
export function load({ depends }) { | ||
depends('invalidate-depends:goto'); | ||
return { | ||
layoutDate: new Date().getTime() | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/kit/test/apps/basics/src/routes/load/invalidation/invalidate-then-goto/+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,7 @@ | ||
/** @type {import('./$types').PageServerLoad} */ | ||
export function load({ url }) { | ||
url.searchParams.get('x'); | ||
return { | ||
pageDate: new Date().getTime() | ||
}; | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/kit/test/apps/basics/src/routes/load/invalidation/invalidate-then-goto/+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,23 @@ | ||
<script> | ||
import { invalidate, goto } from '$app/navigation'; | ||
/** @type {import('./$types').PageData} */ | ||
export let data; | ||
</script> | ||
|
||
<p class="layout">{data.layoutDate}</p> | ||
<p class="page">{data.pageDate}</p> | ||
<button | ||
type="button" | ||
class="invalidate" | ||
on:click={() => (window.promise = invalidate('invalidate-depends:goto'))} | ||
> | ||
invalidate | ||
</button> | ||
<button | ||
type="button" | ||
class="goto" | ||
on:click={() => (window.promise = goto('/load/invalidation/invalidate-then-goto?x'))} | ||
> | ||
goto | ||
</button> |
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