Fix hot reload diffing to empty rsx (#3567)

* Fix hot reloading to empty rsx

* Only normalize the template when hot reloading and rendering

* add a test for emptying out an rsx block in hot reloading
This commit is contained in:
Evan Almloff authored and GitHub committed 2025-01-21 00:33:29 -08:00
1 parent 2c6a5212fc
commit f99e50b0aa
3 files changed
+61 -26

No files matched your search

+5 -2
View File
@@ -122,7 +122,10 @@ impl HotReloadResult {
new: &TemplateBody,
name: String,
) -> Option<Self> {
let full_rebuild_state = LastBuildState::new(full_rebuild_state, name);
// Normalize both the full rebuild state and the new state for rendering
let full_rebuild_state = full_rebuild_state.normalized();
let new = new.normalized();
let full_rebuild_state = LastBuildState::new(&full_rebuild_state, name);
let mut s = Self {
full_rebuild_state,
templates: Default::default(),
@@ -131,7 +134,7 @@ impl HotReloadResult {
literal_component_properties: Default::default(),
};
s.hotreload_body::<Ctx>(new)?;
s.hotreload_body::<Ctx>(&new)?;
Some(s)
}