mirror of
https://github.com/loro-dev/loro.git
synced 2024-11-28 09:25:36 +00:00
fix: tree diff calc children should be sorted by idlp (#401)
This commit is contained in:
parent
71e5afa6cc
commit
00e9c8d031
3 changed files with 214 additions and 935 deletions
|
@ -161,6 +161,12 @@ impl Actor {
|
|||
}
|
||||
|
||||
pub fn check_history(&mut self) {
|
||||
// let json = self
|
||||
// .loro
|
||||
// .export_json_updates(&Default::default(), &self.loro.oplog_vv());
|
||||
// let string = serde_json::to_string_pretty(&json).unwrap();
|
||||
// tracing::info!("json = {}", string);
|
||||
|
||||
for (f, v) in self.history.iter() {
|
||||
let f = Frontiers::from(f);
|
||||
let from = &self.loro.state_frontiers();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -449,7 +449,12 @@ impl TreeCacheForDiff {
|
|||
ans.push((*tree_id, op.position.clone(), op.id_full()));
|
||||
}
|
||||
}
|
||||
ans.sort_by(|a, b| a.1.cmp(&b.1));
|
||||
// The children should be sorted by the position.
|
||||
// If the fractional index is the same, then sort by the lamport and peer.
|
||||
ans.sort_by(|a, b| {
|
||||
a.1.cmp(&b.1)
|
||||
.then(a.2.lamport.cmp(&b.2.lamport).then(a.2.peer.cmp(&b.2.peer)))
|
||||
});
|
||||
ans
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue