Compute diff

This commit is contained in:
JuanM04 2024-07-18 14:16:31 -03:00
parent f29cd2baf4
commit ccf9a0820a
No known key found for this signature in database

View File

@ -286,7 +286,14 @@ export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndo
if (getState(store, rightID.client) <= rightID.clock) {
return null
}
const res = followUndoneDeletions ? followRedone(store, rightID) : { item: getItem(store, rightID), diff: 0 }
/** @type {ReturnType<typeof followRedone>} */
let res;
if (followUndoneDeletions) {
res = followRedone(store, rightID)
} else {
const item = getItem(store, rightID)
res = { item, diff: rightID.clock - item.id.clock }
}
const right = res.item
if (!(right instanceof Item)) {
return null