-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix extra invalidation with component prop binding to object property (…
- Loading branch information
Showing
4 changed files
with
43 additions
and
14 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
6 changes: 6 additions & 0 deletions
6
test/runtime/samples/component-binding-reactive-property-no-extra-call/Component.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,6 @@ | ||
<script> | ||
export let value; | ||
export let value2; | ||
</script> | ||
|
||
{value}{value2} |
5 changes: 5 additions & 0 deletions
5
test/runtime/samples/component-binding-reactive-property-no-extra-call/_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,5 @@ | ||
export default { | ||
async test({ assert, component }) { | ||
assert.equal(component.object_updates, component.primitive_updates); | ||
} | ||
}; |
13 changes: 13 additions & 0 deletions
13
test/runtime/samples/component-binding-reactive-property-no-extra-call/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,13 @@ | ||
<script> | ||
import Component from './Component.svelte'; | ||
export let primitive_updates = 0; | ||
export let object_updates = 0; | ||
const obj = { foo: '' }; | ||
let foo = 'bar'; | ||
$: if (obj) object_updates++; | ||
$: if (foo) primitive_updates++; | ||
</script> | ||
|
||
<Component bind:value={obj.foo} bind:value2={foo} /> |