mirror of https://github.com/sveltejs/svelte
fix: ensure each key validation occurs for updates (#12836)
* fix: ensure each key validation occurs for updates * fix: ensure each key validation occurs for updatespull/12838/head
parent
555e90f932
commit
873a184b41
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure each key validation occurs for updates
|
@ -0,0 +1,16 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
test({ assert, target }) {
|
||||
let button = target.querySelector('button');
|
||||
|
||||
button?.click();
|
||||
|
||||
assert.throws(flushSync, /each_key_duplicate/);
|
||||
}
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
<script>
|
||||
let data = [
|
||||
[0, 0],
|
||||
[0, 4],
|
||||
[1, 4],
|
||||
];
|
||||
|
||||
function add() {
|
||||
const n = [0, 0]
|
||||
data.push(n);
|
||||
data = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button onclick={add}>add</button>
|
||||
|
||||
<ul>
|
||||
{#each data as d (d.join(""))}
|
||||
<li> {d}</li>
|
||||
{/each}
|
||||
</ul>
|
Loading…
Reference in new issue