-
-
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: adjust keyed each block equality handling
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 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: adjust keyed each block equality handling |
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
21 changes: 21 additions & 0 deletions
21
packages/svelte/tests/runtime-runes/samples/each-updates-4/_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,21 @@ | ||
import { flushSync } from 'svelte'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `100\n<button>Update</button>`, | ||
|
||
async test({ assert, target }) { | ||
/** | ||
* @type {{ click: () => void; }} | ||
*/ | ||
let btn1; | ||
|
||
[btn1] = target.querySelectorAll('button'); | ||
|
||
flushSync(() => { | ||
btn1.click(); | ||
}); | ||
|
||
assert.htmlEqual(target.innerHTML, `1000\n<button>Update</button>`); | ||
} | ||
}); |
13 changes: 13 additions & 0 deletions
13
packages/svelte/tests/runtime-runes/samples/each-updates-4/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 { writable } from "svelte/store"; | ||
const roomState = writable({ | ||
users: {"gary": { name: "gary", value: 100 }}, | ||
}); | ||
</script> | ||
|
||
{#each Object.values($roomState.users) as user (user.name)} | ||
{user.value} | ||
{/each} | ||
|
||
<button onclick={() => $roomState.users["gary"].value = 1000}>Update</button> |