Remove push_future, get use_future kinda working again

This commit is contained in:
Jonathan Kelley committed 2024-01-15 19:34:04 -08:00
1 parent 14651a3573
commit a32ae8b112
8 files changed
+49 -60

No files matched your search

+2 -7
View File
@@ -62,14 +62,9 @@ pub fn suspend() -> Option<Element> {
None
}
/// Pushes the future onto the poll queue to be polled after the component renders.
pub fn push_future(fut: impl Future<Output = ()> + 'static) -> Option<Task> {
with_current_scope(|cx| cx.push_future(fut))
}
/// Spawns the future but does not return the [`TaskId`]
pub fn spawn(fut: impl Future<Output = ()> + 'static) {
with_current_scope(|cx| cx.spawn(fut));
pub fn spawn(fut: impl Future<Output = ()> + 'static) -> Task {
with_current_scope(|cx| cx.spawn(fut)).expect("to be in a dioxus runtime")
}
/// Spawn a future that Dioxus won't clean up when this component is unmounted