mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update modified tracked changes in the React state (#20877)
GitOrigin-RevId: d3b17908aa43d99b6e46550f2de77186f9d7b86d
This commit is contained in:
parent
ee2e95ec01
commit
9ba6a6a042
1 changed files with 18 additions and 7 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue