Merge pull request #32779 from overleaf/mj-project-history-bug

[project-history] Fix broken ranges from history resync

GitOrigin-RevId: c839e1d187768b7ce3411d06f78f017ebf7fec6e
This commit is contained in:
Mathias Jakobsen
2026-04-17 08:05:42 +00:00
committed by Copybot
parent e3ebc52334
commit cae558af69
3 changed files with 272 additions and 0 deletions
@@ -314,6 +314,15 @@ function _concatTwoUpdates(firstUpdate, secondUpdate) {
return [firstUpdate, secondUpdate]
}
if (firstUpdate.meta.resync || secondUpdate.meta.resync) {
// Do not merge ops where one of them is a resync. We produce a list of
// resync ops that first corrects the content, then the ranges. By
// compressing the content updates seperately from the ranges updates,
// the ranges can become out-of-sync. To stop this, disallow compressing
// any resync updates.
return [firstUpdate, secondUpdate]
}
if (firstUpdate.meta.user_id !== secondUpdate.meta.user_id) {
return [firstUpdate, secondUpdate]
}