diff --git a/packages/hooks/src/use_coroutine.rs b/packages/hooks/src/use_coroutine.rs index 04bb655f7..cdfc56856 100644 --- a/packages/hooks/src/use_coroutine.rs +++ b/packages/hooks/src/use_coroutine.rs @@ -1,6 +1,6 @@ use dioxus_core::prelude::{consume_context, provide_context, spawn, use_hook}; use dioxus_core::Task; -use dioxus_signals::{CopyValue, Signal}; +use dioxus_signals::*; pub use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender}; use std::future::Future; @@ -71,7 +71,7 @@ where G: FnOnce(UnboundedReceiver) -> F, F: Future + 'static, { - let coroutine = use_hook(|| { + let mut coroutine = use_hook(|| { provide_context(Coroutine { needs_regen: Signal::new(true), tx: CopyValue::new(None), @@ -81,12 +81,12 @@ where // We do this here so we can capture data with FnOnce // this might not be the best API - if *coroutine.needs_regen.read() { + if *coroutine.needs_regen.peek() { let (tx, rx) = futures_channel::mpsc::unbounded(); let task = spawn(init(rx)); coroutine.tx.set(Some(tx)); coroutine.task.set(Some(task)); - coroutine.needs_regen.set_untracked(false); + coroutine.needs_regen.set(false); } coroutine diff --git a/packages/hooks/src/use_future.rs b/packages/hooks/src/use_future.rs index 048242d13..f352aebf1 100644 --- a/packages/hooks/src/use_future.rs +++ b/packages/hooks/src/use_future.rs @@ -3,7 +3,7 @@ use dioxus_core::{ prelude::{spawn, use_hook}, ScopeState, Task, }; -use dioxus_signals::{use_effect, use_signal, Effect, Signal}; +use dioxus_signals::*; use futures_util::{future, pin_mut, FutureExt}; use std::{any::Any, cell::Cell, future::Future, pin::Pin, rc::Rc, sync::Arc, task::Poll}; diff --git a/packages/hooks/src/use_resource.rs b/packages/hooks/src/use_resource.rs index 126a8fde0..45af784ba 100644 --- a/packages/hooks/src/use_resource.rs +++ b/packages/hooks/src/use_resource.rs @@ -3,7 +3,7 @@ use dioxus_core::{ prelude::{spawn, use_hook}, ScopeState, Task, }; -use dioxus_signals::{use_effect, use_signal, Effect, Signal}; +use dioxus_signals::*; use futures_util::{future, pin_mut, FutureExt}; use std::{any::Any, cell::Cell, future::Future, pin::Pin, rc::Rc, sync::Arc, task::Poll};