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
@@ -270,11 +270,9 @@ impl Element {
|
||||
}
|
||||
|
||||
// Merge raw literals into the output
|
||||
if let AttributeValue::AttrLiteral(lit) = &matching_attr.value {
|
||||
if let HotLiteralType::Fmted(new) = &lit.value {
|
||||
out.push_ifmt(new.clone());
|
||||
continue;
|
||||
}
|
||||
if let AttributeValue::AttrLiteral(HotLiteral::Fmted(lit)) = &matching_attr.value {
|
||||
out.push_ifmt(lit.formatted_input.clone());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Merge `if cond { "abc" } else if ...` into the output
|
||||
@@ -289,10 +287,7 @@ impl Element {
|
||||
);
|
||||
}
|
||||
|
||||
let out_lit = HotLiteral {
|
||||
value: HotLiteralType::Fmted(out),
|
||||
hr_idx: Default::default(),
|
||||
};
|
||||
let out_lit = HotLiteral::Fmted(out.into());
|
||||
|
||||
self.merged_attributes.push(Attribute {
|
||||
name: attr.name.clone(),
|
||||
@@ -305,11 +300,11 @@ impl Element {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn key(&self) -> Option<&IfmtInput> {
|
||||
pub(crate) fn key(&self) -> Option<&AttributeValue> {
|
||||
for attr in &self.raw_attributes {
|
||||
if let AttributeName::BuiltIn(name) = &attr.name {
|
||||
if name == "key" {
|
||||
return attr.ifmt();
|
||||
return Some(&attr.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user