Prechádzať zdrojové kódy

fix use_hook imports

Evan Almloff 1 rok pred
rodič
commit
20480c0a2d

+ 1 - 1
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::{

+ 2 - 2
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,

+ 0 - 12
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<Output = ()> + 'static, scope_id: ScopeId) -> Option<Task> {
-    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<Output = ()> + 'static) -> Option<Task> {
-    spawn_at(fut, ScopeId(0))
-}

+ 1 - 2
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};