Skip to content

Commit

Permalink
Clear layout cache when loading an image
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Dec 6, 2024
1 parent 19799b5 commit c3c21a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/blitz-dom/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c3c21a9

Please sign in to comment.