@@ -27,7 +27,7 @@ import { useEffectiveDiffSource } from "../hooks/useEffectiveDiffSource";
2727import { useReviewDiffs } from "../hooks/useReviewDiffs" ;
2828import { useReviewNavigationStore } from "../reviewNavigationStore" ;
2929import type { DiffOptions } from "../types" ;
30- import { buildItemIndex , ReviewShell , useReviewState } from "./ReviewShell" ;
30+ import { ReviewShell , useReviewState } from "./ReviewShell" ;
3131import {
3232 buildPatchReviewItems ,
3333 buildRemoteReviewItems ,
@@ -108,15 +108,18 @@ export function ReviewPage({ task }: ReviewPageProps) {
108108 } = useEffectiveDiffSource ( taskId ) ;
109109
110110 const showReviewComments = useDiffViewerStore ( ( s ) => s . showReviewComments ) ;
111- const { commentThreads } = usePrDetails ( prUrl , {
112- includeComments : isReviewOpen ,
111+ const { commentThreads, commentsLoading } = usePrDetails ( prUrl , {
112+ includeComments : isReviewOpen && showReviewComments ,
113113 } ) ;
114114 const effectiveCommentThreads = showReviewComments
115115 ? commentThreads
116116 : undefined ;
117117 const commentedFilePaths = useMemo (
118- ( ) => ( prUrl ? getCommentedFilePaths ( commentThreads ) : undefined ) ,
119- [ commentThreads , prUrl ] ,
118+ ( ) =>
119+ prUrl && ! commentsLoading
120+ ? getCommentedFilePaths ( commentThreads )
121+ : undefined ,
122+ [ commentThreads , commentsLoading , prUrl ] ,
120123 ) ;
121124
122125 const isLocalActive = isReviewOpen && effectiveSource === "local" ;
@@ -425,8 +428,6 @@ function LocalReviewContent({
425428 unstagedParsedFiles ,
426429 ] ) ;
427430
428- const itemIndexByFilePath = useMemo ( ( ) => buildItemIndex ( items ) , [ items ] ) ;
429-
430431 return (
431432 < ReviewShell
432433 task = { task }
@@ -447,7 +448,6 @@ function LocalReviewContent({
447448 prSourceAvailable = { prSourceAvailable }
448449 defaultBranch = { defaultBranch }
449450 items = { items }
450- itemIndexByFilePath = { itemIndexByFilePath }
451451 commentedFilePaths = { commentedFilePaths }
452452 unresolvedCommentedFilePaths = { unresolvedCommentedFilePaths }
453453 currentSignatures = { currentSignatures }
@@ -543,8 +543,6 @@ function RemoteReviewPage({
543543 taskId ,
544544 ] ,
545545 ) ;
546- const itemIndexByFilePath = useMemo ( ( ) => buildItemIndex ( items ) , [ items ] ) ;
547-
548546 return (
549547 < ReviewShell
550548 task = { task }
@@ -564,7 +562,6 @@ function RemoteReviewPage({
564562 prSourceAvailable = { prSourceAvailable }
565563 defaultBranch = { defaultBranch }
566564 items = { items }
567- itemIndexByFilePath = { itemIndexByFilePath }
568565 commentedFilePaths = { commentedFilePaths }
569566 unresolvedCommentedFilePaths = { unresolvedCommentedFilePaths }
570567 currentSignatures = { currentSignatures }
0 commit comments