mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-02 02:59:51 +00:00
fix: tree apply diff when before dead after alive
This commit is contained in:
parent
bcabf682e9
commit
a6f8c9c2d2
1 changed files with 21 additions and 9 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue