mirror of https://github.com/sveltejs/svelte
fix: apply ownership mutation ignores to bindings (#18718)
Fixes #18715. Copy ignore comment info to the generated assignment so it's recognized later --------- Co-authored-by: svelte-triage-bot <team@svelte.com> Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/18721/head
parent
68e7c9b521
commit
c7d8233a5c
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: apply ownership mutation ignores to binding assignments
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let { item } = $props();
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore ownership_invalid_mutation -->
|
||||
<input bind:value={item.heading} />
|
||||
@ -0,0 +1,22 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { ok, test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
test({ assert, target, warnings }) {
|
||||
const input = target.querySelector('input');
|
||||
const output = target.querySelector('p');
|
||||
ok(input);
|
||||
ok(output);
|
||||
|
||||
input.value = 'renamed';
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
flushSync();
|
||||
|
||||
assert.equal(output.textContent, 'renamed');
|
||||
assert.deepEqual(warnings, []);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import Item from './Item.svelte';
|
||||
|
||||
let item = $state({ heading: 'initial' });
|
||||
</script>
|
||||
|
||||
<Item {item} />
|
||||
<p>{item.heading}</p>
|
||||
Loading…
Reference in new issue