-
-
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.
* feat: Allow bypassing `invalidateAll` in `enhance` * changeset * typedoc * oops * cleanup * Update .changeset/shaggy-trainers-drum.md * technically fixed, though types will have to catch up * Revert "technically fixed, though types will have to catch up" oops, wrong branch This reverts commit a9ae11b. * Update .changeset/shaggy-trainers-drum.md Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * Update packages/kit/test/apps/dev-only/package.json Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * fix: Types --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> Co-authored-by: Rich Harris <richard.a.harris@gmail.com> Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
- Loading branch information
1 parent
96993cf
commit 050447a
Showing
7 changed files
with
88 additions
and
5 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': minor | ||
--- | ||
|
||
feat: add `invalidateAll` boolean option to `enhance` callback |
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
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
packages/kit/test/apps/basics/src/routes/actions/invalidate-all/+layout.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() { | ||
return { | ||
changes_every_load: new Date() | ||
}; | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/kit/test/apps/basics/src/routes/actions/invalidate-all/+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,10 @@ | ||
export function load({ url }) { | ||
const invalidate_all = url.searchParams.get('invalidate_all') === 'true'; | ||
return { | ||
invalidate_all | ||
}; | ||
} | ||
|
||
export const actions = { | ||
default: () => {} | ||
}; |
22 changes: 22 additions & 0 deletions
22
packages/kit/test/apps/basics/src/routes/actions/invalidate-all/+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,22 @@ | ||
<script> | ||
import { enhance } from '$app/forms'; | ||
export let data; | ||
/** | ||
* @param {HTMLFormElement} node | ||
*/ | ||
function enhanceWrapper(node) { | ||
return enhance( | ||
node, | ||
() => | ||
({ update }) => | ||
update({ invalidateAll: data.invalidate_all }) | ||
); | ||
} | ||
</script> | ||
|
||
<form method="POST" use:enhanceWrapper> | ||
<pre>{data.changes_every_load.toISOString()}</pre> | ||
<button type="submit">invalidate</button> | ||
</form> |
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