Skip to content
TypeScript

fix(web): hide back button for single linked pull requests (#11520)

maria2ec59ca1fad6
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 4e8b370d382..7994b3196f5 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -4228,10 +4228,11 @@ export default function ChatView(props: ChatViewProps) {
}, [activeThreadRef]);
const supportsThreadPullRequests =
serverConfig?.environment.capabilities.threadPullRequests === true;
+ const visiblePullRequestCount = visibleThreadPullRequests(
+ (activeThreadShell ?? activeThread)?.pullRequests ?? [],
+ ).length;
const pullRequestsSurfaceAvailable =
- isServerThread &&
- supportsThreadPullRequests &&
- visibleThreadPullRequests((activeThreadShell ?? activeThread)?.pullRequests ?? []).length > 0;
+ isServerThread && supportsThreadPullRequests && visiblePullRequestCount > 0;
const addPullRequestsSurface = useCallback(() => {
if (!activeThreadRef || !pullRequestsSurfaceAvailable) return;
useRightPanelStore.getState().open(activeThreadRef, "pull-requests");
@@ -8544,7 +8545,7 @@ export default function ChatView(props: ChatViewProps) {
}
composerDraftTarget={composerDraftTarget}
onBack={
- activeThreadRef !== null && pullRequestsSurfaceAvailable
+ activeThreadRef !== null && pullRequestsSurfaceAvailable && visiblePullRequestCount > 1
? addPullRequestsSurface
: undefined
}