Switch to a pool of dynamic values for hot reloading (#2705)
* create the dynamic value pool * assign ids to dynamic formatted segments * separate the rendering and literal pools * rsx output compiles again * more examples compiling with new rsx expansion * update template body explanation * all workspace examples compile * fix formatted segments in keys * start hot reload diffing * fix component literal hot reloading * start integrate new hot reloading with the CLI * simple hot reloads working * Fix hot reloading blocks with components * implement hot reloading for if chains * Fix hot reloading after a template requires a full rebuild * Fix hot reloading any attribute values * remove unsafe from hot reload utils * Fix hot reloading empty rsx * add more hot reloading tests * reorganize hot reload module * fix web hydration * fix empty rsx nodes in autoformatting * fix tests * remove path sorting logic from core * make template names more consistent in debug mode * fix quote_as_hot_reload_literal for explicitly typed literals * fix can_be_shorthand for string literals * fix formatted single dynamic expression * Fix usize component properties and playwright tests * remove default implementation for TemplateBody * add a bunch more comments for diffing, scoring and why this scoring system is optimal
This commit is contained in:
1 parent
f3ca1484a1
commit
34bdcd15cf
40 files changed
+2288
-1897
No files matched your search
@@ -15,7 +15,7 @@ fn attributes_pass_properly() {
|
||||
|
||||
let o = h.unwrap();
|
||||
|
||||
let template = &o.template.get();
|
||||
let template = &o.template;
|
||||
|
||||
assert_eq!(template.attr_paths.len(), 3);
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::ElementId;
|
||||
use dioxus_core::Mutation::{AppendChildren, LoadTemplate};
|
||||
|
||||
/// Swap out the template and get it back via the mutation
|
||||
#[test]
|
||||
fn hotreloads_template() {
|
||||
let old_rsx = rsx! { "A" };
|
||||
let name = old_rsx.as_ref().unwrap().template.get().name;
|
||||
|
||||
let mut dom = VirtualDom::new_with_props(move |_| old_rsx.clone(), ());
|
||||
|
||||
let new_template = Template {
|
||||
name,
|
||||
roots: &[TemplateNode::Text { text: "B" }],
|
||||
node_paths: &[],
|
||||
attr_paths: &[],
|
||||
};
|
||||
|
||||
dom.replace_template(new_template);
|
||||
|
||||
let muts = dom.rebuild_to_vec();
|
||||
|
||||
// New template comes out
|
||||
assert_eq!(muts.templates.len(), 1);
|
||||
|
||||
assert_eq!(
|
||||
muts.edits,
|
||||
[
|
||||
LoadTemplate {
|
||||
name: "packages/core/tests/hotreload.rs:8:19:0",
|
||||
index: 0,
|
||||
id: ElementId(1,),
|
||||
},
|
||||
AppendChildren { id: ElementId(0,), m: 1 },
|
||||
]
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user