From 8461c25ffd0a11dfb537b081ed8460283d04f033 Mon Sep 17 00:00:00 2001 From: maria Date: Fri, 11 Sep 2026 21:36:13 -0300 Subject: [PATCH] fix(web): disable linked pull requests when none are linked (#11348) --- apps/web/src/components/ChatView.tsx | 15 ++++++++++----- apps/web/src/components/CommandPalette.tsx | 2 ++ apps/web/src/components/RightPanelTabs.tsx | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 212c23ecdb3d48d23478d5a4f6a4bb78c60bf5ca..b74f5a073250edb2004b24d2c24cda7fea32d39d 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1,4 +1,5 @@ import { useLoadBalancedEnvironment } from "../hooks/useLoadBalancedEnvironment"; +import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests"; import type { UsageLimitSourceSnapshots } from "@t3tools/contracts"; import { collectProviderUsageLimits, @@ -4203,10 +4204,14 @@ export default function ChatView(props: ChatViewProps) { }, [activeThreadRef]); const supportsThreadPullRequests = serverConfig?.environment.capabilities.threadPullRequests === true; + const pullRequestsSurfaceAvailable = + isServerThread && + supportsThreadPullRequests && + visibleThreadPullRequests((activeThreadShell ?? activeThread)?.pullRequests ?? []).length > 0; const addPullRequestsSurface = useCallback(() => { - if (!activeThreadRef || !supportsThreadPullRequests) return; + if (!activeThreadRef || !pullRequestsSurfaceAvailable) return; useRightPanelStore.getState().open(activeThreadRef, "pull-requests"); - }, [activeThreadRef, supportsThreadPullRequests]); + }, [activeThreadRef, pullRequestsSurfaceAvailable]); const { state: deviceState, loaded: deviceStateLoaded } = useDeviceState( activeThreadRef?.environmentId ?? null, ); @@ -8340,7 +8345,7 @@ export default function ChatView(props: ChatViewProps) { } composerDraftTarget={composerDraftTarget} onBack={ - activeThreadRef !== null && supportsThreadPullRequests + activeThreadRef !== null && pullRequestsSurfaceAvailable ? addPullRequestsSurface : undefined } @@ -8981,7 +8986,7 @@ export default function ChatView(props: ChatViewProps) { diffAvailable={isServerThread && isGitRepo} filesAvailable={activeProject !== null} pullRequestAvailable={pullRequestSurfaceAvailable} - pullRequestsAvailable={isServerThread && supportsThreadPullRequests} + pullRequestsAvailable={pullRequestsSurfaceAvailable} agentsAvailable deviceAvailable={activeThreadRef !== null} liveAgentCount={agentPanelModel.liveCount} @@ -9039,7 +9044,7 @@ export default function ChatView(props: ChatViewProps) { diffAvailable={isServerThread && isGitRepo} filesAvailable={activeProject !== null} pullRequestAvailable={pullRequestSurfaceAvailable} - pullRequestsAvailable={isServerThread && supportsThreadPullRequests} + pullRequestsAvailable={pullRequestsSurfaceAvailable} agentsAvailable deviceAvailable={activeThreadRef !== null} liveAgentCount={agentPanelModel.liveCount} diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 3533678ecb2d47ec2653a9b5ba62a2e40b617f82..72842dd2a1dcd33869393abe35423119772c530a 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -1,6 +1,7 @@ "use client"; import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility"; +import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests"; import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment"; import { @@ -1708,6 +1709,7 @@ function OpenCommandPaletteDialog(props: { value: "action:open-thread-pull-requests", searchTerms: ["pull requests", "linked", "stack", "prs"], title: "Show linked pull requests", + disabled: visibleThreadPullRequests(activeThread.pullRequests).length === 0, icon: , run: async () => { useRightPanelStore.getState().open(threadRef, "pull-requests"); diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx index c791a632b79ed21cc4c7536a115defed8e597b9b..e0fb70b8080d5f9b4f008c60860fb0897068ac89 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -154,7 +154,7 @@ const SURFACE_DISABLED_REASONS = { files: "Files are only available when a project is open.", diff: "Diff is only available for server threads in Git repositories.", pullRequest: "This thread's branch has no pull request yet.", - pullRequests: "Linked pull requests are only available for server threads.", + pullRequests: "No linked pull requests are available for this thread.", agents: "Agents are only available from a thread.", device: "Devices are only available from a thread.", } as const; @@ -178,7 +178,7 @@ const SURFACE_UNAVAILABLE_HINTS = { files: "Available when a project is open.", diff: "Available for Git repositories.", pullRequest: "No pull request on this branch yet.", - pullRequests: "Available for server threads.", + pullRequests: "No linked pull requests available.", agents: "Available from a thread.", device: "Available from a thread.", } as const; -- 2.54.0