forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve prop binding warning validation for stores (sveltejs#12745)
* fix: improve prop binding warning validation for stores * ts * address feedback * add comment * failing test * fix/simplify --------- Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
d06174e
commit 1942f87
Showing
7 changed files
with
61 additions
and
28 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 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: improve prop binding warning validation for stores |
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
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/svelte/tests/runtime-runes/samples/binding-property-store/Child.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,5 @@ | ||
<script> | ||
let { value = $bindable() } = $props(); | ||
</script> | ||
|
||
<input type="number" bind:value /> |
11 changes: 11 additions & 0 deletions
11
packages/svelte/tests/runtime-runes/samples/binding-property-store/_config.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,11 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
mode: ['client'], | ||
compileOptions: { | ||
dev: true | ||
}, | ||
async test({ warnings, assert }) { | ||
assert.deepEqual(warnings, []); | ||
} | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/svelte/tests/runtime-runes/samples/binding-property-store/main.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,12 @@ | ||
<script> | ||
import { writable } from 'svelte/store'; | ||
import Child from './Child.svelte'; | ||
let a = writable({ value: 0 }); | ||
let b = writable({ nested: { value: 0 } }); | ||
</script> | ||
|
||
<Child bind:value={$a.value} /> | ||
<Child bind:value={$b.nested.value} /> | ||
<p>{$a.value}</p> | ||
<p>{$b.nested.value}</p> |