diff --git a/packages/blitz-dom/src/document.rs b/packages/blitz-dom/src/document.rs index 1f7a0299..75c9fab5 100644 --- a/packages/blitz-dom/src/document.rs +++ b/packages/blitz-dom/src/document.rs @@ -641,7 +641,10 @@ impl Document { match kind { ImageType::Image => { node.element_data_mut().unwrap().node_specific_data = - NodeSpecificData::Image(ImageData::from(image)) + NodeSpecificData::Image(ImageData::from(image)); + + // Clear layout cache + node.cache.clear(); } ImageType::Background(idx) => { if let Some(Some(bg_image)) = node @@ -661,6 +664,9 @@ impl Document { ImageType::Image => { node.element_data_mut().unwrap().node_specific_data = NodeSpecificData::Image(ImageData::Svg(*tree)); + + // Clear layout cache + node.cache.clear(); } ImageType::Background(idx) => { if let Some(Some(bg_image)) = node