From c3c21a92b640e6fb687bc2b88fbacbe17e4b6dab Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Sat, 7 Dec 2024 10:42:00 +1300 Subject: [PATCH] Clear layout cache when loading an image --- packages/blitz-dom/src/document.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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