mirror of https://github.com/sveltejs/svelte
fix: only update lazy properties that have actually changed (#10415)
* fix: only update lazy properties that have actually changed * code golf * changeset * Add testpull/10409/head
parent
9aa0ed3eb6
commit
f9f5d3a1be
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: only update lazy properties that have actually changed
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
let { array } = $props();
|
||||
</script>
|
||||
|
||||
{#each array as number}
|
||||
<p>{number}</p>
|
||||
{/each}
|
@ -0,0 +1,14 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
const [b1] = target.querySelectorAll('button');
|
||||
b1.click();
|
||||
await Promise.resolve();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<button>add</button><p>1</p><p>2</p><p>3</p><p>4</p><p>0</p>'
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let array = $state([1,2,3,4]);
|
||||
|
||||
const addNew = () => {
|
||||
array.push(0)
|
||||
}
|
||||
</script>
|
||||
|
||||
<button onclick={addNew}>add</button>
|
||||
<Child {array} />
|
||||
|
Loading…
Reference in new issue