fix: `update_version` after `delete` if `source` is `undefined` and `prop` in `target` (#15796)

* fix: `update_version` after `delete` if `source` is `undefined` and `prop` in `target`

* chore: remove submodule

* tweak test

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/15800/head
Paolo Ricciuti 5 months ago committed by GitHub
parent d8c6afde94
commit 3d80884029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: `update_version` after `delete` if `source` is `undefined` and `prop` in `target`

@ -100,6 +100,7 @@ export function proxy(value) {
prop,
with_parent(() => source(UNINITIALIZED, stack))
);
update_version(version);
}
} else {
// When working with arrays, we need to also ensure we update the length when removing

@ -0,0 +1,13 @@
import { test } from '../../test';
import { flushSync } from 'svelte';
export default test({
html: `<button>delete</button><p>test</p>`,
async test({ assert, target }) {
const btn = target.querySelector('button');
flushSync(() => btn?.click());
assert.htmlEqual(target.innerHTML, '<button>delete</button>');
}
});

@ -0,0 +1,13 @@
<script>
let obj = $state({test: 0})
let keys = $derived(Object.keys(obj));
</script>
<button onclick={() => delete obj.test}>
delete
</button>
{#each keys as key}
<p>{key}</p>
{/each}
Loading…
Cancel
Save