Remove an extra CopyValue::invalid from maybe_sync_memo

This commit is contained in:
Evan Almloff 2024-01-24 14:33:39 -06:00
parent 1eb989a544
commit 30ef29d195

View file

@ -261,9 +261,6 @@ impl<T: PartialEq + 'static> Signal<T> {
pub fn maybe_sync_memo<S: Storage<SignalData<T>>>(
mut f: impl FnMut() -> T + 'static,
) -> ReadOnlySignal<T, S> {
let mut state = Signal::<T, S> {
inner: CopyValue::invalid(),
};
let effect = Effect {
source: current_scope_id().expect("in a virtual dom"),
inner: CopyValue::invalid(),
@ -272,12 +269,7 @@ impl<T: PartialEq + 'static> Signal<T> {
{
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<T, S> = Signal::new_maybe_sync(f());
{
EFFECT_STACK.with(|stack| stack.effects.write().pop());
}