remove once, restore use_hook

This commit is contained in:
Evan Almloff committed 2024-01-15 09:05:46 -06:00
1 parent 36e9eb1160
commit 01726d6656
9 files changed
+19 -23

No files matched your search

+2 -2
View File
@@ -39,7 +39,7 @@ pub(crate) fn get_effect_stack() -> EffectStack {
/// Create a new effect. The effect will be run immediately and whenever any signal it reads changes.
/// The signal will be owned by the current component and will be dropped when the component is dropped.
pub fn use_effect(callback: impl FnMut() + 'static) {
once(|| Effect::new(callback));
use_hook(|| Effect::new(callback));
}
/// Create a new effect. The effect will be run immediately and whenever any signal it reads changes.
@@ -51,7 +51,7 @@ pub fn use_effect_with_dependencies<D: Dependency>(
D::Out: 'static,
{
let dependencies_signal = use_signal(|| dependencies.out());
once(|| {
use_hook(|| {
Effect::new(move || {
let deref = &*dependencies_signal.read();
callback(deref.clone());