mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #20728 from overleaf/dp-state-field-error
Safeguard against addCommentStateField not existing GitOrigin-RevId: 06f5f72bc12552b9668892a50d9789d6dfc45a9e
This commit is contained in:
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user