From 40b6bfe9cabcaa932584f30f0710f8f69d6eb95d Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 4 Mar 2026 10:26:28 -0500 Subject: [PATCH] fix: less aggressive widget state tree diffing responsive widget requires that diffing not reset state tree when number of child widgets change. I worry that this could cause regressions in some apps, but otherwise responsive widgets will discard state for their contents without an id container --- core/src/widget/tree.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/core/src/widget/tree.rs b/core/src/widget/tree.rs index 58da733b..7035c2c9 100644 --- a/core/src/widget/tree.rs +++ b/core/src/widget/tree.rs @@ -203,9 +203,7 @@ impl Tree { { std::mem::swap(&mut self.state, &mut state); let widget_children = borrowed.children(); - if !tag_match - || self.children.len() != widget_children.len() - { + if !tag_match { self.children = widget_children; } else { for (old_i, mut old) in children { @@ -244,11 +242,6 @@ impl Tree { if let Some(id) = self.id.clone() { borrowed.set_id(id); } - let borrowed_children = borrowed.children(); - - if self.children.len() != borrowed_children.len() { - self.children = borrowed_children; - } } } if tag_match {