mirror of https://github.com/sveltejs/svelte
fix: use coarse-grained updates for derived expressions in legacy mode (#11652)
fixes #11648 Also deduplicates the code a bitpull/11659/head
parent
54083fb9cc
commit
c2f75dc7ba
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: use coarse-grained updates for derived expressions passed to props in legacy mode
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
child: {x.y}
|
@ -0,0 +1,10 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `child: 0 parent: 0 <button>inc x</button>`,
|
||||
|
||||
async test({ assert, target }) {
|
||||
await target.querySelector('button')?.click();
|
||||
assert.htmlEqual(target.innerHTML, `child: 1 parent: 1 <button>inc x</button>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import Child from "./Child.svelte";
|
||||
|
||||
let x;
|
||||
$: if (!x) x = {y:0};
|
||||
</script>
|
||||
|
||||
<Child x={x ?? {}} />
|
||||
|
||||
parent: {x.y}
|
||||
<button on:click={() => x.y++}>inc x</button>
|
Loading…
Reference in new issue