From 20480c0a2dbeff79483be88cc701879e6f9e7aee Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 15 Jan 2024 09:10:15 -0600 Subject: [PATCH] fix use_hook imports --- packages/core/src/error_boundary.rs | 2 +- packages/core/src/lib.rs | 4 ++-- packages/core/src/scope_context.rs | 12 ------------ packages/signals/src/signal.rs | 3 +-- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/core/src/error_boundary.rs b/packages/core/src/error_boundary.rs index 909d9384a..7c1e27a22 100644 --- a/packages/core/src/error_boundary.rs +++ b/packages/core/src/error_boundary.rs @@ -1,7 +1,7 @@ use crate::{ global_context::{consume_context, current_scope_id}, innerlude::provide_context, - once, Element, IntoDynNode, Properties, ScopeId, Template, TemplateAttribute, TemplateNode, + use_hook, Element, IntoDynNode, Properties, ScopeId, Template, TemplateAttribute, TemplateNode, VNode, }; use std::{ diff --git a/packages/core/src/lib.rs b/packages/core/src/lib.rs index 56fbd2f74..6f8016add 100644 --- a/packages/core/src/lib.rs +++ b/packages/core/src/lib.rs @@ -72,7 +72,7 @@ pub(crate) mod innerlude { } pub use crate::innerlude::{ - fc_to_builder, generation, once, schedule_update, schedule_update_any, vdom_is_rendering, + fc_to_builder, generation, schedule_update, schedule_update_any, use_hook, vdom_is_rendering, AnyValue, Attribute, AttributeValue, CapturedError, Component, DynamicNode, Element, ElementId, Event, Fragment, HasAttributes, IntoDynNode, Mutation, Mutations, NoOpMutations, Properties, RenderReturn, ScopeId, Task, Template, TemplateAttribute, TemplateNode, VComponent, VNode, @@ -85,7 +85,7 @@ pub use crate::innerlude::{ pub mod prelude { pub use crate::innerlude::{ consume_context, consume_context_from_scope, current_scope_id, fc_to_builder, generation, - has_context, needs_update, once, parent_scope, provide_context, provide_root_context, + has_context, needs_update, parent_scope, provide_context, provide_root_context, push_future, remove_future, schedule_update, schedule_update_any, spawn, spawn_forever, suspend, use_error_boundary, use_hook, AnyValue, Attribute, Component, Element, ErrorBoundary, Event, EventHandler, Fragment, HasAttributes, IntoAttributeValue, diff --git a/packages/core/src/scope_context.rs b/packages/core/src/scope_context.rs index 131dcb8c8..5adfefab5 100644 --- a/packages/core/src/scope_context.rs +++ b/packages/core/src/scope_context.rs @@ -389,15 +389,3 @@ impl ScopeId { with_scope(self, |cx| cx.height()).expect("to be in a dioxus runtime") } } - -/// Spawn a future on a component given its [`ScopeId`]. -pub fn spawn_at(fut: impl Future + 'static, scope_id: ScopeId) -> Option { - with_runtime(|rt| rt.get_context(scope_id).unwrap().push_future(fut)) -} - -/// Spawn a future that Dioxus won't clean up when this component is unmounted -/// -/// This is good for tasks that need to be run after the component has been dropped. -pub fn spawn_forever(fut: impl Future + 'static) -> Option { - spawn_at(fut, ScopeId(0)) -} diff --git a/packages/signals/src/signal.rs b/packages/signals/src/signal.rs index 9f4258ff7..33e497728 100644 --- a/packages/signals/src/signal.rs +++ b/packages/signals/src/signal.rs @@ -7,9 +7,8 @@ use std::{ }; use dioxus_core::{ - once, prelude::{current_scope_id, has_context, provide_context, schedule_update_any}, - ScopeId, + use_hook, ScopeId, }; use generational_box::{GenerationalRef, GenerationalRefMut};