mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Update modified tracked changes in the React state (#20877)
GitOrigin-RevId: d3b17908aa43d99b6e46550f2de77186f9d7b86d
This commit is contained in:
@@ -32,13 +32,24 @@ type RangesActions = {
|
||||
}
|
||||
|
||||
const buildRanges = (currentDoc: DocumentContainer | null) => {
|
||||
if (currentDoc?.ranges) {
|
||||
return {
|
||||
...currentDoc.ranges,
|
||||
docId: currentDoc.doc_id,
|
||||
total:
|
||||
currentDoc.ranges.changes.length + currentDoc.ranges.comments.length,
|
||||
}
|
||||
const ranges = currentDoc?.ranges
|
||||
|
||||
if (!ranges) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const dirtyState = ranges.getDirtyState()
|
||||
ranges.resetDirtyState()
|
||||
|
||||
return {
|
||||
changes: ranges.changes.map(change =>
|
||||
change.id in dirtyState.change ? { ...change } : change
|
||||
),
|
||||
comments: ranges.comments.map(comment =>
|
||||
comment.id in dirtyState.comment ? { ...comment } : comment
|
||||
),
|
||||
docId: currentDoc.doc_id,
|
||||
total: ranges.changes.length + ranges.comments.length,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user