@@ -3419,12 +3419,10 @@ function ChatViewContent(props: ChatViewProps) {
34193419 if ( ! supportsPullRequests || ! activeThreadRef || ! activeProject ) {
34203420 return ;
34213421 }
3422- const linkedPullRequest =
3423- linkedThreadPullRequest ?. number === number ? linkedThreadPullRequest : null ;
3424- const repository = linkedPullRequest ?. repository ?? activeProjectRepository ;
3422+ const repository = linkedThreadPullRequest ?. repository ?? activeProjectRepository ;
34253423 if ( repository === null ) return ;
34263424 useRightPanelStore . getState ( ) . openPullRequest ( activeThreadRef , {
3427- projectId : linkedPullRequest ?. projectId ?? activeProject . id ,
3425+ projectId : linkedThreadPullRequest ?. projectId ?? activeProject . id ,
34283426 repository,
34293427 number,
34303428 } ) ;
@@ -3437,6 +3435,24 @@ function ChatViewContent(props: ChatViewProps) {
34373435 supportsPullRequests ,
34383436 ] ,
34393437 ) ;
3438+ const openProjectPullRequest = useCallback (
3439+ ( number : number ) => {
3440+ if (
3441+ ! supportsPullRequests ||
3442+ ! activeThreadRef ||
3443+ ! activeProject ||
3444+ activeProjectRepository === null
3445+ ) {
3446+ return ;
3447+ }
3448+ useRightPanelStore . getState ( ) . openPullRequest ( activeThreadRef , {
3449+ projectId : activeProject . id ,
3450+ repository : activeProjectRepository ,
3451+ number,
3452+ } ) ;
3453+ } ,
3454+ [ activeProject , activeProjectRepository , activeThreadRef , supportsPullRequests ] ,
3455+ ) ;
34403456 const togglePreviewPanel = useCallback ( ( ) => {
34413457 if ( ! activeThreadRef || ! isPreviewSupportedInRuntime ( ) ) return ;
34423458 if ( previewPanelOpen ) {
@@ -6634,9 +6650,9 @@ function ChatViewContent(props: ChatViewProps) {
66346650 >
66356651 { ! rightPanelOpen ? panelLayoutControls : null }
66366652 < ChatHeader
6637- { ...( ! supportsPullRequests || threadRepository === null
6653+ { ...( ! supportsPullRequests || activeProjectRepository === null
66386654 ? { }
6639- : { onOpenPullRequest : openThreadPullRequest } ) }
6655+ : { onOpenPullRequest : openProjectPullRequest } ) }
66406656 activeThreadEnvironmentId = { activeThread . environmentId }
66416657 activeThreadId = { activeThread . id }
66426658 { ...( routeKind === "draft" && draftId ? { draftId } : { } ) }
0 commit comments