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
This commit is contained in:
Ashley Wulber 2026-03-04 10:26:28 -05:00
parent 14cefe034e
commit 40b6bfe9ca

View file

@ -203,9 +203,7 @@ impl Tree {
{ {
std::mem::swap(&mut self.state, &mut state); std::mem::swap(&mut self.state, &mut state);
let widget_children = borrowed.children(); let widget_children = borrowed.children();
if !tag_match if !tag_match {
|| self.children.len() != widget_children.len()
{
self.children = widget_children; self.children = widget_children;
} else { } else {
for (old_i, mut old) in children { for (old_i, mut old) in children {
@ -244,11 +242,6 @@ impl Tree {
if let Some(id) = self.id.clone() { if let Some(id) = self.id.clone() {
borrowed.set_id(id); borrowed.set_id(id);
} }
let borrowed_children = borrowed.children();
if self.children.len() != borrowed_children.len() {
self.children = borrowed_children;
}
} }
} }
if tag_match { if tag_match {