mirror of https://github.com/sveltejs/svelte
fix: prevent undefined value when remount keyed input element with spread props (#7699)
Fixes: #7578 When remounting a keyed input element (e.g. because the element order has changed) with spread properties, the input value gets undefined. This has happened because data_value is updated before remounting and it won't contain a value for input-value (because the value hasn't changed). When calling mount() an undefined value was assigned because of a missing check.pull/8335/head
parent
8cf037c904
commit
474a13ad90
@ -0,0 +1,11 @@
|
|||||||
|
export default {
|
||||||
|
test({ assert, component, target }) {
|
||||||
|
const [input1, input2] = target.querySelectorAll('input');
|
||||||
|
assert.equal(input1.value, 'value1');
|
||||||
|
assert.equal(input2.value, 'value2');
|
||||||
|
|
||||||
|
component.items = component.items.reverse();
|
||||||
|
assert.equal(input1.value, 'value1');
|
||||||
|
assert.equal(input2.value, 'value2');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
export let items = ['value1', 'value2'];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each items as item (item)}
|
||||||
|
<input value={item} {...{}} />
|
||||||
|
{/each}
|
Loading…
Reference in new issue