-
-
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: Un-shadow `data` and `form` in `enhance`, warn about future deprecation in dev * changeset * snek * Update .changeset/odd-crews-own.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> * am not smart * still not smart * oops * oof * add deprecation notice --------- Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> Co-authored-by: Rich Harris <git@rich-harris.dev>
- Loading branch information
1 parent
7042766
commit 4a85b7f
Showing
7 changed files
with
197 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': minor | ||
--- | ||
|
||
feat: unshadow `data` and `form` in `enhance` and warn about future deprecation when used in `dev` mode |
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
26 changes: 26 additions & 0 deletions
26
packages/kit/test/apps/basics/src/routes/actions/enhance/old-property-access/+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,26 @@ | ||
// TODO 2.0: Remove this code and corresponding tests | ||
export const actions = { | ||
form_submit: () => { | ||
return { | ||
form_submit: true | ||
}; | ||
}, | ||
|
||
form_callback: () => { | ||
return { | ||
form_callback: true | ||
}; | ||
}, | ||
|
||
data_submit: () => { | ||
return { | ||
data_submit: true | ||
}; | ||
}, | ||
|
||
data_callback: () => { | ||
return { | ||
data_callback: true | ||
}; | ||
} | ||
}; |
52 changes: 52 additions & 0 deletions
52
packages/kit/test/apps/basics/src/routes/actions/enhance/old-property-access/+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,52 @@ | ||
<script> | ||
import { enhance } from '$app/forms'; | ||
export let form; | ||
const access_form_submit = (node) => { | ||
return enhance(node, ({ form }) => {}); | ||
}; | ||
const access_data_submit = (node) => { | ||
return enhance(node, ({ data }) => {}); | ||
}; | ||
const access_form_callback = (node) => { | ||
return enhance( | ||
node, | ||
() => | ||
({ form, update }) => | ||
update() | ||
); | ||
}; | ||
const access_data_callback = (node) => { | ||
return enhance( | ||
node, | ||
() => | ||
({ data, update }) => | ||
update() | ||
); | ||
}; | ||
</script> | ||
|
||
<form method="POST" action="?/form_submit" use:access_form_submit> | ||
<button id="access-form-in-submit" type="submit" | ||
>{form?.form_submit ? 'processed' : 'not processed'}</button | ||
> | ||
</form> | ||
|
||
<form method="POST" action="?/data_submit" use:access_data_submit> | ||
<button id="access-data-in-submit" type="submit" | ||
>{form?.data_submit ? 'processed' : 'not processed'}</button | ||
> | ||
</form> | ||
|
||
<form method="POST" action="?/form_callback" use:access_form_callback> | ||
<button id="access-form-in-callback" type="submit" | ||
>{form?.form_callback ? 'processed' : 'not processed'}</button | ||
> | ||
</form> | ||
|
||
<form method="POST" action="?/data_callback" use:access_data_callback> | ||
<button id="access-data-in-callback" type="submit" | ||
>{form?.data_callback ? 'processed' : 'not processed'}</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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "test-basics", | ||
"name": "test-dev-only", | ||
"private": true, | ||
"version": "0.0.2-next.0", | ||
"scripts": { | ||
|
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