ensure we only create sources in effect_active()

proxied-state-set
Dominic Gannaway 12 months ago
parent e2a6619a53
commit 1c92ddc272

@ -109,7 +109,7 @@ const handler = {
const metadata = target[STATE_SYMBOL];
const has = Reflect.has(target, prop);
let s = metadata.s.get(prop);
if (!has || s !== undefined || get_descriptor(target, prop)?.writable) {
if (s !== undefined || (effect_active() && (!has || get_descriptor(target, prop)?.writable))) {
if (s === undefined) {
s = source(has ? proxy(target[prop]) : UNINITIALIZED);
metadata.s.set(prop, s);

Loading…
Cancel
Save