mirror of https://github.com/sveltejs/svelte
fix: loosen proxy signal creation heuristics (#11109)
* fix: loosen proxy signal creation heuristics * tighten up test * update comment * no need to create a source outside an effect here, because it can't result in a reference * preserve reference to props.$$events --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/11111/head
parent
27891cb2dd
commit
3bb231197e
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: loosen proxy signal creation heuristics
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
const { settings } = $props();
|
||||
import { settings } from './main.svelte';
|
||||
</script>
|
||||
|
||||
Child: {settings.showInRgb}
|
||||
|
@ -1,19 +1,19 @@
|
||||
<script context="module">
|
||||
export const context = $state({
|
||||
const context = $state({
|
||||
settings: {
|
||||
showInRgb: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
export const settings = context.settings;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
const { settings } = context
|
||||
</script>
|
||||
|
||||
<button onclick={() => settings.showInRgb = !settings.showInRgb}>
|
||||
click {settings.showInRgb}
|
||||
</button>
|
||||
|
||||
<Child settings={settings} />
|
||||
<Child />
|
||||
|
Loading…
Reference in new issue