* clear away prelude on dioxus * clippy * wip - drop prelude from dioxus-html * docs clippy * wip * more fixe * delete all preludes * doc... * better export * merge some imports * fewer global imports * global incremental renderer * fix cargo doc
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
use crate::{
|
|
fc_to_builder, properties::RootProps, DynamicNode, Element, ErrorBoundary, Properties,
|
|
SuspenseBoundary, Template, TemplateNode, VComponent, VNode,
|
|
};
|
|
|
|
// We wrap the root scope in a component that renders it inside a default ErrorBoundary and SuspenseBoundary
|
|
#[allow(non_snake_case)]
|
|
#[allow(clippy::let_and_return)]
|
|
pub(crate) fn RootScopeWrapper(props: RootProps<VComponent>) -> Element {
|
|
static TEMPLATE: Template = Template {
|
|
roots: &[TemplateNode::Dynamic { id: 0usize }],
|
|
node_paths: &[&[0u8]],
|
|
attr_paths: &[],
|
|
};
|
|
Element::Ok(VNode::new(
|
|
None,
|
|
TEMPLATE,
|
|
Box::new([DynamicNode::Component(
|
|
fc_to_builder(SuspenseBoundary)
|
|
.fallback(|_| Element::Ok(VNode::placeholder()))
|
|
.children(Ok(VNode::new(
|
|
None,
|
|
TEMPLATE,
|
|
Box::new([DynamicNode::Component({
|
|
fc_to_builder(ErrorBoundary)
|
|
.children(Element::Ok(VNode::new(
|
|
None,
|
|
TEMPLATE,
|
|
Box::new([DynamicNode::Component(props.0)]),
|
|
Box::new([]),
|
|
)))
|
|
.build()
|
|
.into_vcomponent(ErrorBoundary)
|
|
})]),
|
|
Box::new([]),
|
|
)))
|
|
.build()
|
|
.into_vcomponent(SuspenseBoundary),
|
|
)]),
|
|
Box::new([]),
|
|
))
|
|
}
|