From 30ef29d195ea20ad99ce6ca10b56d5a875c400bd Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 24 Jan 2024 14:33:39 -0600 Subject: [PATCH] Remove an extra CopyValue::invalid from maybe_sync_memo --- packages/signals/src/signal.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/signals/src/signal.rs b/packages/signals/src/signal.rs index 94e95b13b..a11df5640 100644 --- a/packages/signals/src/signal.rs +++ b/packages/signals/src/signal.rs @@ -261,9 +261,6 @@ impl Signal { pub fn maybe_sync_memo>>( mut f: impl FnMut() -> T + 'static, ) -> ReadOnlySignal { - let mut state = Signal:: { - inner: CopyValue::invalid(), - }; let effect = Effect { source: current_scope_id().expect("in a virtual dom"), inner: CopyValue::invalid(), @@ -272,12 +269,7 @@ impl Signal { { EFFECT_STACK.with(|stack| stack.effects.write().push(effect)); } - state.inner.value.set(SignalData { - subscribers: Default::default(), - update_any: schedule_update_any(), - value: f(), - effect_ref: get_effect_ref(), - }); + let mut state: Signal = Signal::new_maybe_sync(f()); { EFFECT_STACK.with(|stack| stack.effects.write().pop()); }