Skip to content

Commit 40b6bfe

Browse files
committed
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
1 parent 14cefe0 commit 40b6bfe

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

core/src/widget/tree.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,7 @@ impl Tree {
203203
{
204204
std::mem::swap(&mut self.state, &mut state);
205205
let widget_children = borrowed.children();
206-
if !tag_match
207-
|| self.children.len() != widget_children.len()
208-
{
206+
if !tag_match {
209207
self.children = widget_children;
210208
} else {
211209
for (old_i, mut old) in children {
@@ -244,11 +242,6 @@ impl Tree {
244242
if let Some(id) = self.id.clone() {
245243
borrowed.set_id(id);
246244
}
247-
let borrowed_children = borrowed.children();
248-
249-
if self.children.len() != borrowed_children.len() {
250-
self.children = borrowed_children;
251-
}
252245
}
253246
}
254247
if tag_match {

0 commit comments

Comments
 (0)