mirror of https://github.com/sveltejs/svelte
fix: improve proxy effect dependency tracking (#10605)
parent
6afaf75a37
commit
c10337cfb2
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: improve proxy effect dependency tracking
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
let context = getContext('container');
|
||||
|
||||
$effect(() => {
|
||||
context.register('test');
|
||||
return () => context.unregister('test');
|
||||
});
|
||||
</script>
|
||||
|
||||
<div>Item</div>
|
@ -0,0 +1,9 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test({ assert, target }) {
|
||||
flushSync();
|
||||
assert.htmlEqual(target.innerHTML, `<div>Item</div>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
import { setContext } from 'svelte';
|
||||
|
||||
import Item from './Item.svelte'
|
||||
|
||||
let items = $state({});
|
||||
|
||||
setContext('container', {
|
||||
register: (id) => items[id] = true,
|
||||
unregister: (id) => delete items[id]
|
||||
});
|
||||
</script>
|
||||
|
||||
<Item />
|
Loading…
Reference in new issue