fix: tree apply diff when before dead after alive

This commit is contained in:
leeeon233 2024-08-22 16:44:52 +08:00
parent bcabf682e9
commit a6f8c9c2d2
No known key found for this signature in database
GPG key ID: 38CA3B145509B66D

View file

@ -937,15 +937,27 @@ impl ContainerState for TreeState {
}
// Otherwise, it's a normal move inside deleted nodes, no event is needed
} else {
// normal move
ans.push(TreeDiffItem {
target,
action: TreeExternalDiff::Move {
parent: parent.into_node().ok(),
index: self.get_index_by_tree_id(&target).unwrap(),
position: position.clone(),
},
});
if was_alive {
// normal move
ans.push(TreeDiffItem {
target,
action: TreeExternalDiff::Move {
parent: parent.into_node().ok(),
index: self.get_index_by_tree_id(&target).unwrap(),
position: position.clone(),
},
});
} else {
// create event
ans.push(TreeDiffItem {
target,
action: TreeExternalDiff::Create {
parent: parent.into_node().ok(),
index: self.get_index_by_tree_id(&target).unwrap(),
position: position.clone(),
},
});
}
}
}
} else {