more consistent naming of the root component in core

This commit is contained in:
Evan Almloff 2024-01-11 15:23:37 -06:00
parent 7fe6e05da3
commit 3267ddec10
7 changed files with 31 additions and 31 deletions

View file

@ -139,7 +139,7 @@ impl ErrorBoundary {
///
/// ```rust, ignore
/// #[component]
/// fn App( count: String) -> Element {
/// fn app( count: String) -> Element {
/// let id: i32 = count.parse().throw()?;
///
/// cx.render(rsx! {
@ -164,7 +164,7 @@ pub trait Throw<S = ()>: Sized {
///
/// ```rust, ignore
/// #[component]
/// fn App( count: String) -> Element {
/// fn app( count: String) -> Element {
/// let id: i32 = count.parse().throw()?;
///
/// cx.render(rsx! {
@ -187,7 +187,7 @@ pub trait Throw<S = ()>: Sized {
///
/// ```rust, ignore
/// #[component]
/// fn App( count: String) -> Element {
/// fn app( count: String) -> Element {
/// let id: i32 = count.parse().throw()?;
///
/// cx.render(rsx! {

View file

@ -62,7 +62,7 @@ impl<const A: bool> FragmentBuilder<A> {
/// ## Example
///
/// ```rust, ignore
/// fn App() -> Element {
/// fn app() -> Element {
/// cx.render(rsx!{
/// CustomCard {
/// h1 {}

View file

@ -158,7 +158,7 @@ impl ScopeContext {
/// ```rust, ignore
/// struct SharedState(&'static str);
///
/// static App: Component = |cx| {
/// static app: Component = |cx| {
/// cx.use_hook(|| cx.provide_context(SharedState("world")));
/// render!(Child {})
/// }

View file

@ -34,7 +34,7 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
/// title: String
/// }
///
/// fn App(cx: AppProps) -> Element {
/// fn app(cx: AppProps) -> Element {
/// cx.render(rsx!(
/// div {"hello, {cx.title}"}
/// ))
@ -55,7 +55,7 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
/// static ROUTES: &str = "";
///
/// #[component]
/// fn App(cx: AppProps) -> Element {
/// fn app(cx: AppProps) -> Element {
/// cx.render(rsx!(
/// NavBar { routes: ROUTES }
/// Title { "{cx.title}" }
@ -88,9 +88,9 @@ use std::{any::Any, cell::Cell, collections::BTreeSet, future::Future, rc::Rc};
///
/// ```rust
/// # 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();
/// ```
///
@ -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.
/// ```rust, ignore
/// #[component]
/// fn App() -> Element {
/// fn app() -> Element {
/// cx.render(rsx! {
/// div { "Hello World" }
/// })
/// }
///
/// let dom = VirtualDom::new(App);
/// let dom = VirtualDom::new(app);
///
/// real_dom.apply(dom.rebuild());
///
@ -464,7 +464,7 @@ impl VirtualDom {
/// # Example
///
/// ```rust, ignore
/// let dom = VirtualDom::new(App);
/// let dom = VirtualDom::new(app);
/// let sender = dom.get_scheduler_channel();
/// ```
pub async fn wait_for_work(&mut self) {
@ -545,7 +545,7 @@ impl VirtualDom {
///
/// # Example
/// ```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 edits = dom.rebuild();

View file

@ -5,7 +5,7 @@ use dioxus_core::ElementId;
/// Should push the text node onto the stack and modify it
#[test]
fn nested_passthru_creates() {
fn App() -> Element {
fn app() -> Element {
render! {
PassThru {
PassThru {
@ -20,7 +20,7 @@ fn nested_passthru_creates() {
render!(children)
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
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
#[test]
fn nested_passthru_creates_add() {
fn App() -> Element {
fn app() -> Element {
render! {
ChildComp {
"1"
@ -57,7 +57,7 @@ fn nested_passthru_creates_add() {
render! {children}
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
assert_eq!(
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
#[test]
fn dynamic_node_as_root() {
fn App() -> Element {
fn app() -> Element {
let a = 123;
let b = 456;
render! { "{a}", "{b}" }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
// Since the roots were all dynamic, they should not cause any template muations

View file

@ -7,7 +7,7 @@ use std::rc::Rc;
#[test]
fn miri_rollover() {
set_event_converter(Box::new(SerializedHtmlEventConverter));
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = 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 onhover = |_| println!("go!");

View file

@ -2,11 +2,11 @@ use dioxus::prelude::*;
#[test]
fn app_drops() {
fn App() -> Element {
fn app() -> Element {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@ -15,7 +15,7 @@ fn app_drops() {
#[test]
fn hooks_drop() {
fn App() -> Element {
fn app() -> Element {
once(|| String::from("asd"));
once(|| String::from("asd"));
once(|| String::from("asd"));
@ -24,7 +24,7 @@ fn hooks_drop() {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@ -33,7 +33,7 @@ fn hooks_drop() {
#[test]
fn contexts_drop() {
fn App() -> Element {
fn app() -> Element {
provide_context(String::from("asd"));
render! {
@ -47,7 +47,7 @@ fn contexts_drop() {
render! { div { "hello {el}" } }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@ -56,7 +56,7 @@ fn contexts_drop() {
#[test]
fn tasks_drop() {
fn App() -> Element {
fn app() -> Element {
spawn(async {
// tokio::time::sleep(std::time::Duration::from_millis(100000)).await;
});
@ -64,7 +64,7 @@ fn tasks_drop() {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@ -88,7 +88,7 @@ fn root_props_drop() {
#[test]
fn diffing_drops_old() {
fn App() -> Element {
fn app() -> Element {
render! {
div {
match generation() % 2 {
@ -110,7 +110,7 @@ fn diffing_drops_old() {
render! {"Goodbye {name}"}
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);