Skip to content

Commit

Permalink
fix(core): state order and handling of new trees
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and mmstick committed Jul 5, 2024
1 parent 4c609e7 commit 6f83a8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/widget/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Tree {
let state = mem::replace(&mut tree.state, State::None);
let children_count = tree.children.len();
let children =
tree.children.iter_mut().rev().enumerate().map(|(i, c)| {
tree.children.iter_mut().enumerate().rev().map(|(i, c)| {
if matches!(c.id, Some(Id(Internal::Custom(_, _)))) {
(c, None)
} else {
Expand Down Expand Up @@ -350,7 +350,11 @@ impl Tree {
}

for (new_tree, i) in new_trees {
self.children.insert(i, new_tree);
if self.children.len() > i {
self.children[i] = new_tree;
} else {
self.children.push(new_tree);
}
}
}
}
Expand Down

0 comments on commit 6f83a8d

Please sign in to comment.