Fix effect by using a set_inner
This commit is contained in:
4 files changed
+11
-2
No files matched your search
@@ -14,6 +14,10 @@ fn app() -> Element {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
use_effect(move || {
|
||||||
|
println!("High-Five counter: {}", count());
|
||||||
|
});
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div { "High-Five counter: {count}" }
|
div { "High-Five counter: {count}" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ fn ReadsManySignals() -> Element {
|
|||||||
},
|
},
|
||||||
"Increase First Item"
|
"Increase First Item"
|
||||||
}
|
}
|
||||||
for signal in data.many_signals {
|
for signal in data.many_signals.iter() {
|
||||||
Child { count: *signal }
|
Child { count: *signal }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ impl EffectInner {
|
|||||||
callback: Box::new(callback),
|
callback: Box::new(callback),
|
||||||
id: copy.id(),
|
id: copy.id(),
|
||||||
};
|
};
|
||||||
copy.set(inner);
|
copy.set_inner(inner);
|
||||||
copy
|
copy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,11 @@ impl<T: 'static, S: Storage<T>> CopyValue<T, S> {
|
|||||||
pub fn id(&self) -> GenerationalBoxId {
|
pub fn id(&self) -> GenerationalBoxId {
|
||||||
self.value.id()
|
self.value.id()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the inner value directory without going `Write`
|
||||||
|
pub fn set_inner(&self, value: T) {
|
||||||
|
self.value.set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: 'static, S: Storage<T>> Readable<T> for CopyValue<T, S> {
|
impl<T: 'static, S: Storage<T>> Readable<T> for CopyValue<T, S> {
|
||||||
|
|||||||
Reference in new issue
Block a user