Files
dioxus/packages/core/src/root_wrapper.rs
T
Jonathan KelleyandEvan Almloff 0de3bf7aeb Fix nested rsx expansion by not using template titles (#2799)
* Fix nested rsx expansion by not using template titles

* fix writers with nameless templates

* fix clippy

* dont commit vscode fix

* fix release mode, pull out __template_name

* fix axum_desktop

* Fix core tests

* Make most fields of HotReloadedTemplate public for testing

* wip: formatting, compare all diff cases

* slightly smarter diffing for dynamic nodes

* add a comment about generic node diffing

* clean up mutations a bit

* fix load template

* simplify maybe_rebuild

* Restore write mutations flag in web

* write_mutations -> skip_mutations

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-08-13 01:59:04 +00:00

41 lines
1.5 KiB
Rust

use crate::{prelude::*, properties::RootProps, DynamicNode, VComponent};
// 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(ErrorBoundary)
.children(Element::Ok(VNode::new(
None,
TEMPLATE,
Box::new([DynamicNode::Component({
#[allow(unused_imports)]
fc_to_builder(SuspenseBoundary)
.fallback(|_| Element::Ok(VNode::placeholder()))
.children(Ok(VNode::new(
None,
TEMPLATE,
Box::new([DynamicNode::Component(props.0)]),
Box::new([]),
)))
.build()
.into_vcomponent(SuspenseBoundary)
})]),
Box::new([]),
)))
.build()
.into_vcomponent(ErrorBoundary),
)]),
Box::new([]),
))
}