Fix the router and stub out a number of crates to get compiling

This commit is contained in:
Jonathan Kelley committed 2024-01-13 20:51:37 -08:00
1 parent 4c6e515da4
commit fae0b08e61
226 files changed
+1057 -1482

No files matched your search

+4
View File
@@ -99,6 +99,10 @@ pub fn once<State: Clone + 'static>(initializer: impl FnOnce() -> State) -> Stat
with_current_scope(|cx| cx.use_hook(initializer)).expect("to be in a dioxus runtime")
}
pub fn use_hook<State: Clone + 'static>(initializer: impl FnOnce() -> State) -> State {
once(initializer)
}
/// Get the current render since the inception of this component
///
/// This can be used as a helpful diagnostic when debugging hooks/renders, etc
+1 -1
View File
@@ -87,7 +87,7 @@ pub mod prelude {
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,
push_future, remove_future, schedule_update, schedule_update_any, spawn, spawn_forever,
suspend, use_error_boundary, AnyValue, Component, Element, ErrorBoundary, Event,
suspend, use_error_boundary, use_hook, AnyValue, Component, Element, ErrorBoundary, Event,
EventHandler, Fragment, IntoAttributeValue, IntoDynNode, Properties, Runtime, RuntimeGuard,
ScopeId, Task, Template, TemplateAttribute, TemplateNode, Throw, VNode, VNodeInner,
VirtualDom,
+7 -4
View File
@@ -1,6 +1,9 @@
use crate::any_props::{BoxedAnyProps, VProps};
use crate::innerlude::{ElementRef, EventHandler, MountId, ScopeState};
use crate::innerlude::{ElementRef, EventHandler, MountId};
use crate::properties::ComponentFunction;
use crate::{
any_props::{BoxedAnyProps, VProps},
innerlude::ScopeState,
};
use crate::{arena::ElementId, Element, Event};
use crate::{Properties, VirtualDom};
use std::ops::Deref;
@@ -16,7 +19,7 @@ pub type TemplateId = &'static str;
/// The actual state of the component's most recent computation
///
/// Because Dioxus accepts components in the form of `async fn(Scope) -> Result<VNode>`, we need to support both
/// Because Dioxus accepts components in the form of `async fn() -> Result<VNode>`, we need to support both
/// sync and async versions.
///
/// Dioxus will do its best to immediately resolve any async components into a regular Element, but as an implementor
@@ -457,7 +460,7 @@ impl VComponent {
///
/// ```rust, ignore
/// // Without explicit props
/// fn(Scope) -> Element;
/// fn() -> Element;
/// async fn(Scope<'_>) -> Element;
///
/// // With explicit props
+2 -2
View File
@@ -1,9 +1,9 @@
use crate::{
any_props::{AnyProps, BoxedAnyProps},
innerlude::DirtyScope,
innerlude::{DirtyScope, ScopeState},
nodes::RenderReturn,
scope_context::ScopeContext,
scopes::{ScopeId, ScopeState},
scopes::ScopeId,
virtual_dom::VirtualDom,
};
+1 -1
View File
@@ -254,7 +254,7 @@ impl ScopeContext {
/// use dioxus_core::ScopeState;
///
/// // prints a greeting on the initial render
/// pub fn use_hello_world(cx: &ScopeState) {
/// pub fn use_hello_world() {
/// cx.use_hook(|| println!("Hello, world!"));
/// }
/// ```
+3 -3
View File
@@ -6,13 +6,13 @@ use crate::{
any_props::{BoxedAnyProps, VProps},
arena::ElementId,
innerlude::{
DirtyScope, ElementRef, ErrorBoundary, NoOpMutations, Scheduler, SchedulerMsg, VNodeMount,
WriteMutations,
DirtyScope, ElementRef, ErrorBoundary, NoOpMutations, Scheduler, SchedulerMsg, ScopeState,
VNodeMount, WriteMutations,
},
nodes::RenderReturn,
nodes::{Template, TemplateId},
runtime::{Runtime, RuntimeGuard},
scopes::{ScopeId, ScopeState},
scopes::ScopeId,
AttributeValue, Element, Event, MutationsVec,
};
use futures_util::{pin_mut, StreamExt};