more consistent naming of the root component in core
This commit is contained in:
1 parent
7fe6e05da3
commit
3267ddec10
7 files changed
+31
-31
No files matched your search
@@ -139,7 +139,7 @@ impl ErrorBoundary {
|
|||||||
///
|
///
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// #[component]
|
/// #[component]
|
||||||
/// fn App( count: String) -> Element {
|
/// fn app( count: String) -> Element {
|
||||||
/// let id: i32 = count.parse().throw()?;
|
/// let id: i32 = count.parse().throw()?;
|
||||||
///
|
///
|
||||||
/// cx.render(rsx! {
|
/// cx.render(rsx! {
|
||||||
@@ -164,7 +164,7 @@ pub trait Throw<S = ()>: Sized {
|
|||||||
///
|
///
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// #[component]
|
/// #[component]
|
||||||
/// fn App( count: String) -> Element {
|
/// fn app( count: String) -> Element {
|
||||||
/// let id: i32 = count.parse().throw()?;
|
/// let id: i32 = count.parse().throw()?;
|
||||||
///
|
///
|
||||||
/// cx.render(rsx! {
|
/// cx.render(rsx! {
|
||||||
@@ -187,7 +187,7 @@ pub trait Throw<S = ()>: Sized {
|
|||||||
///
|
///
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// #[component]
|
/// #[component]
|
||||||
/// fn App( count: String) -> Element {
|
/// fn app( count: String) -> Element {
|
||||||
/// let id: i32 = count.parse().throw()?;
|
/// let id: i32 = count.parse().throw()?;
|
||||||
///
|
///
|
||||||
/// cx.render(rsx! {
|
/// cx.render(rsx! {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl<const A: bool> FragmentBuilder<A> {
|
|||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// fn App() -> Element {
|
/// fn app() -> Element {
|
||||||
/// cx.render(rsx!{
|
/// cx.render(rsx!{
|
||||||
/// CustomCard {
|
/// CustomCard {
|
||||||
/// h1 {}
|
/// h1 {}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ impl ScopeContext {
|
|||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// struct SharedState(&'static str);
|
/// struct SharedState(&'static str);
|
||||||
///
|
///
|
||||||
/// static App: Component = |cx| {
|
/// static app: Component = |cx| {
|
||||||
/// cx.use_hook(|| cx.provide_context(SharedState("world")));
|
/// cx.use_hook(|| cx.provide_context(SharedState("world")));
|
||||||
/// render!(Child {})
|
/// render!(Child {})
|
||||||
/// }
|
/// }
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
|
|||||||
/// title: String
|
/// title: String
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// fn App(cx: AppProps) -> Element {
|
/// fn app(cx: AppProps) -> Element {
|
||||||
/// cx.render(rsx!(
|
/// cx.render(rsx!(
|
||||||
/// div {"hello, {cx.title}"}
|
/// div {"hello, {cx.title}"}
|
||||||
/// ))
|
/// ))
|
||||||
@@ -55,7 +55,7 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
|
|||||||
/// static ROUTES: &str = "";
|
/// static ROUTES: &str = "";
|
||||||
///
|
///
|
||||||
/// #[component]
|
/// #[component]
|
||||||
/// fn App(cx: AppProps) -> Element {
|
/// fn app(cx: AppProps) -> Element {
|
||||||
/// cx.render(rsx!(
|
/// cx.render(rsx!(
|
||||||
/// NavBar { routes: ROUTES }
|
/// NavBar { routes: ROUTES }
|
||||||
/// Title { "{cx.title}" }
|
/// Title { "{cx.title}" }
|
||||||
@@ -88,9 +88,9 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # use dioxus::prelude::*;
|
/// # use dioxus::prelude::*;
|
||||||
/// # fn App() -> Element { cx.render(rsx! { div {} }) }
|
/// # fn app() -> Element { cx.render(rsx! { div {} }) }
|
||||||
///
|
///
|
||||||
/// let mut vdom = VirtualDom::new(App);
|
/// let mut vdom = VirtualDom::new(app);
|
||||||
/// let edits = vdom.rebuild();
|
/// let edits = vdom.rebuild();
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
@@ -127,13 +127,13 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
|
|||||||
/// Putting everything together, you can build an event loop around Dioxus by using the methods outlined above.
|
/// Putting everything together, you can build an event loop around Dioxus by using the methods outlined above.
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// #[component]
|
/// #[component]
|
||||||
/// fn App() -> Element {
|
/// fn app() -> Element {
|
||||||
/// cx.render(rsx! {
|
/// cx.render(rsx! {
|
||||||
/// div { "Hello World" }
|
/// div { "Hello World" }
|
||||||
/// })
|
/// })
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let dom = VirtualDom::new(App);
|
/// let dom = VirtualDom::new(app);
|
||||||
///
|
///
|
||||||
/// real_dom.apply(dom.rebuild());
|
/// real_dom.apply(dom.rebuild());
|
||||||
///
|
///
|
||||||
@@ -464,7 +464,7 @@ impl VirtualDom {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// let dom = VirtualDom::new(App);
|
/// let dom = VirtualDom::new(app);
|
||||||
/// let sender = dom.get_scheduler_channel();
|
/// let sender = dom.get_scheduler_channel();
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn wait_for_work(&mut self) {
|
pub async fn wait_for_work(&mut self) {
|
||||||
@@ -545,7 +545,7 @@ impl VirtualDom {
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust, ignore
|
/// ```rust, ignore
|
||||||
/// static App: Component = |cx| cx.render(rsx!{ "hello world" });
|
/// static app: Component = |cx| cx.render(rsx!{ "hello world" });
|
||||||
///
|
///
|
||||||
/// let mut dom = VirtualDom::new();
|
/// let mut dom = VirtualDom::new();
|
||||||
/// let edits = dom.rebuild();
|
/// let edits = dom.rebuild();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use dioxus_core::ElementId;
|
|||||||
/// Should push the text node onto the stack and modify it
|
/// Should push the text node onto the stack and modify it
|
||||||
#[test]
|
#[test]
|
||||||
fn nested_passthru_creates() {
|
fn nested_passthru_creates() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
render! {
|
render! {
|
||||||
PassThru {
|
PassThru {
|
||||||
PassThru {
|
PassThru {
|
||||||
@@ -20,7 +20,7 @@ fn nested_passthru_creates() {
|
|||||||
render!(children)
|
render!(children)
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
let edits = dom.rebuild_to_vec().santize();
|
let edits = dom.rebuild_to_vec().santize();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -37,7 +37,7 @@ fn nested_passthru_creates() {
|
|||||||
/// Take note on how we don't spit out the template for child_comp since it's entirely dynamic
|
/// Take note on how we don't spit out the template for child_comp since it's entirely dynamic
|
||||||
#[test]
|
#[test]
|
||||||
fn nested_passthru_creates_add() {
|
fn nested_passthru_creates_add() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
render! {
|
render! {
|
||||||
ChildComp {
|
ChildComp {
|
||||||
"1"
|
"1"
|
||||||
@@ -57,7 +57,7 @@ fn nested_passthru_creates_add() {
|
|||||||
render! {children}
|
render! {children}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
dom.rebuild_to_vec().santize().edits,
|
dom.rebuild_to_vec().santize().edits,
|
||||||
@@ -78,13 +78,13 @@ fn nested_passthru_creates_add() {
|
|||||||
/// note that the template is all dynamic roots - so it doesn't actually get cached as a template
|
/// note that the template is all dynamic roots - so it doesn't actually get cached as a template
|
||||||
#[test]
|
#[test]
|
||||||
fn dynamic_node_as_root() {
|
fn dynamic_node_as_root() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
let a = 123;
|
let a = 123;
|
||||||
let b = 456;
|
let b = 456;
|
||||||
render! { "{a}", "{b}" }
|
render! { "{a}", "{b}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
let edits = dom.rebuild_to_vec().santize();
|
let edits = dom.rebuild_to_vec().santize();
|
||||||
|
|
||||||
// Since the roots were all dynamic, they should not cause any template muations
|
// Since the roots were all dynamic, they should not cause any template muations
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::rc::Rc;
|
|||||||
#[test]
|
#[test]
|
||||||
fn miri_rollover() {
|
fn miri_rollover() {
|
||||||
set_event_converter(Box::new(SerializedHtmlEventConverter));
|
set_event_converter(Box::new(SerializedHtmlEventConverter));
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ fn miri_rollover() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
let mut idx = use_signal(|| 0);
|
let mut idx = use_signal(|| 0);
|
||||||
let onhover = |_| println!("go!");
|
let onhover = |_| println!("go!");
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ use dioxus::prelude::*;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn app_drops() {
|
fn app_drops() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
render! { div {} }
|
render! { div {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
dom.mark_dirty(ScopeId::ROOT);
|
dom.mark_dirty(ScopeId::ROOT);
|
||||||
@@ -15,7 +15,7 @@ fn app_drops() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hooks_drop() {
|
fn hooks_drop() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
once(|| String::from("asd"));
|
once(|| String::from("asd"));
|
||||||
once(|| String::from("asd"));
|
once(|| String::from("asd"));
|
||||||
once(|| String::from("asd"));
|
once(|| String::from("asd"));
|
||||||
@@ -24,7 +24,7 @@ fn hooks_drop() {
|
|||||||
render! { div {} }
|
render! { div {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
dom.mark_dirty(ScopeId::ROOT);
|
dom.mark_dirty(ScopeId::ROOT);
|
||||||
@@ -33,7 +33,7 @@ fn hooks_drop() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn contexts_drop() {
|
fn contexts_drop() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
provide_context(String::from("asd"));
|
provide_context(String::from("asd"));
|
||||||
|
|
||||||
render! {
|
render! {
|
||||||
@@ -47,7 +47,7 @@ fn contexts_drop() {
|
|||||||
render! { div { "hello {el}" } }
|
render! { div { "hello {el}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
dom.mark_dirty(ScopeId::ROOT);
|
dom.mark_dirty(ScopeId::ROOT);
|
||||||
@@ -56,7 +56,7 @@ fn contexts_drop() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn tasks_drop() {
|
fn tasks_drop() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
spawn(async {
|
spawn(async {
|
||||||
// tokio::time::sleep(std::time::Duration::from_millis(100000)).await;
|
// tokio::time::sleep(std::time::Duration::from_millis(100000)).await;
|
||||||
});
|
});
|
||||||
@@ -64,7 +64,7 @@ fn tasks_drop() {
|
|||||||
render! { div {} }
|
render! { div {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
dom.mark_dirty(ScopeId::ROOT);
|
dom.mark_dirty(ScopeId::ROOT);
|
||||||
@@ -88,7 +88,7 @@ fn root_props_drop() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn diffing_drops_old() {
|
fn diffing_drops_old() {
|
||||||
fn App() -> Element {
|
fn app() -> Element {
|
||||||
render! {
|
render! {
|
||||||
div {
|
div {
|
||||||
match generation() % 2 {
|
match generation() % 2 {
|
||||||
@@ -110,7 +110,7 @@ fn diffing_drops_old() {
|
|||||||
render! {"Goodbye {name}"}
|
render! {"Goodbye {name}"}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(App);
|
let mut dom = VirtualDom::new(app);
|
||||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||||
dom.mark_dirty(ScopeId::ROOT);
|
dom.mark_dirty(ScopeId::ROOT);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user