mirror of https://github.com/sveltejs/svelte
fix: ensure set_text applies coercion to objects before diff (#13542)
* fix: ensure set_text applies coercion to objects before diff * lint * feedback * Update packages/svelte/src/internal/client/render.js Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>pull/13532/head
parent
8148e63ced
commit
7ac0d8e7cd
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure set_text applies coercion to objects before diff
|
@ -0,0 +1,11 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
btn?.click();
|
||||||
|
flushSync();
|
||||||
|
assert.htmlEqual(target.innerHTML, `<button>add</button><span>1,2,3,4</span>`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
let array = $state([1, 2, 3]);
|
||||||
|
|
||||||
|
function addToArray() {
|
||||||
|
array.push(array.length + 1);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={addToArray}>add</button>
|
||||||
|
|
||||||
|
<span>{array}</span>
|
Loading…
Reference in new issue