fix: one tricky case

This commit is contained in:
Zixuan Chen 2024-08-27 00:17:22 +08:00
parent 819d1f86b9
commit 1a80cb7572
No known key found for this signature in database
2 changed files with 17 additions and 4 deletions

View file

@ -536,10 +536,6 @@ impl AppDag {
return true;
}
if deps == &self.trimmed_frontiers {
return false;
}
deps.iter().any(|x| self.trimmed_vv.includes_id(*x))
}
}

View file

@ -1178,4 +1178,21 @@ fn test_map_checkout_on_trimmed_doc() {
}
})
);
new_doc.checkout_to_latest();
assert_eq!(
new_doc.get_deep_value(),
loro_value!({
"map": {
"0": 0,
"1": 1,
"2": 4,
"3": 3,
}
})
);
let err = new_doc
.checkout(&ID::new(doc.peer_id(), 0).into())
.unwrap_err();
assert_eq!(err, LoroError::SwitchToTrimmedVersion);
}