Build failure on master. (#627)

* Build failure on master.

* Fix ci failure.

* Fix test.

* Ignore broken tests.

* Fix doctests.
This commit is contained in:
David Craven authored and GitHub committed 2022-11-22 09:56:15 -08:00
1 parent f21c8423eb
commit 99dafdb8ee
9 files changed
+61 -29

No files matched your search

+3
View File
@@ -47,6 +47,9 @@ backtrace = { version = "0.3" }
# allows cloing trait objects
dyn-clone = "1.0.9"
[dev-dependencies]
dioxus = { path = "../dioxus" }
[features]
default = []
serialize = ["serde"]
+19 -4
View File
@@ -2,6 +2,11 @@
//! TemplateNodes are different from VNodes in that they can contain partial dynamic and static content in the same node.
//! For example:
//! ```
//! # use dioxus::prelude::*;
//! # let color = "red";
//! # let dynamic_text_1 = "a";
//! # let dynamic_text_2 = "b";
//! # let dynamic_iterator = std::iter::once("");
//! rsx! {
//! div {
//! color: "{color}",
@@ -10,7 +15,7 @@
//! "{dynamic_text_2}",
//! dynamic_iterator
//! }
//! }
//! };
//! ```
//! The above will turn into a template that contains information on how to build div { "Hello, world" } and then every refrence to the template will hydrate with the value of dynamic_text_1, dynamic_text_2, dynamic_iterator, and the color property.
//! The rsx macro will both generate the template and the `DynamicNodeMapping` struct that contains the information on what parts of the template depend on each value of the dynamic context.
@@ -18,6 +23,11 @@
//! Each dynamic part will contain a index into the dynamic context to determine what value to use. The indexes are origionally ordered by traversing the tree depth first from the root.
//! The indexes for the above would be as follows:
//! ```
//! # use dioxus::prelude::*;
//! # let color = "red";
//! # let dynamic_text_1 = "a";
//! # let dynamic_text_2 = "b";
//! # let dynamic_iterator = std::iter::once("");
//! rsx! {
//! div {
//! color: "{color}", // attribute index 0
@@ -26,18 +36,23 @@
//! "{dynamic_text_2}", // text index 1
//! dynamic_iterator // node index 0
//! }
//! }
//! };
//! ```
//! Including these indexes allows hot reloading to move the dynamic parts of the template around.
//! The templates generated by rsx are stored as 'static refrences, but you can change the template at runtime to allow hot reloading.
//! The template could be replaced with a new one at runtime:
//! ```
//! # use dioxus::prelude::*;
//! # let color = "red";
//! # let dynamic_text_1 = "a";
//! # let dynamic_text_2 = "b";
//! # let dynamic_iterator = std::iter::once("");
//! rsx! {
//! div {
//! "Hello, world",
//! dynamic_iterator // node index 0
//! h1 {
//! background_color: "{color}" // attribute index 0
//! background_color: "{color}", // attribute index 0
//! "{dynamic_text_2}", // text index 1
//! }
//! h1 {
@@ -45,7 +60,7 @@
//! "{dynamic_text_1}", // text index 0
//! }
//! }
//! }
//! };
//! ```
//! Notice how the indecies are no longer in depth first traversal order, and indecies are no longer unique. Attributes and dynamic parts of the text can be duplicated, but dynamic vnodes and componets cannot.
//! To minimize the cost of allowing hot reloading on applications that do not use it there are &'static and owned versions of template nodes, and dynamic node mapping.