mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:33:27 +00:00
Merge pull request #20728 from overleaf/dp-state-field-error
Safeguard against addCommentStateField not existing GitOrigin-RevId: 06f5f72bc12552b9668892a50d9789d6dfc45a9e
This commit is contained in:
parent
aba4694377
commit
df2e3c1119
1 changed files with 9 additions and 1 deletions
|
@ -147,7 +147,7 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||
|
||||
const positionsRef = useRef<Map<string, number>>(new Map())
|
||||
|
||||
const addCommentRanges = state.field(addCommentStateField).ranges
|
||||
const addCommentRanges = state.field(addCommentStateField, false)?.ranges
|
||||
|
||||
useEffect(() => {
|
||||
if (aggregatedRanges) {
|
||||
|
@ -178,6 +178,10 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||
}
|
||||
}
|
||||
|
||||
if (!addCommentRanges) {
|
||||
return
|
||||
}
|
||||
|
||||
const cursor = addCommentRanges.iter()
|
||||
|
||||
while (cursor.value) {
|
||||
|
@ -212,6 +216,10 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||
)
|
||||
|
||||
const addCommentEntries = useMemo(() => {
|
||||
if (!addCommentRanges) {
|
||||
return []
|
||||
}
|
||||
|
||||
const cursor = addCommentRanges.iter()
|
||||
|
||||
const entries = []
|
||||
|
|
Loading…
Reference in a new issue