mirror of https://github.com/sveltejs/svelte
parent
d2b6159d2e
commit
48549f7d00
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve internal proxied state signal heuristic
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
const { settings } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Child: {settings.showInRgb}
|
@ -0,0 +1,22 @@
|
|||||||
|
import { flushSync } from '../../../../src/index-client';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<button>click true</button> Child: true`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `<button>click false</button> Child: false`);
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `<button>click true</button> Child: true`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,19 @@
|
|||||||
|
<script context="module">
|
||||||
|
export const context = $state({
|
||||||
|
settings: {
|
||||||
|
showInRgb: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
|
||||||
|
const { settings } = context
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => settings.showInRgb = !settings.showInRgb}>
|
||||||
|
click {settings.showInRgb}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Child settings={settings} />
|
Loading…
Reference in new issue