authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-09-11 21:36:13-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-11 21:36:13-03:00
log8461c25ffd0a11dfb537b081ed8460283d04f033
treec8ec9069dd6a7b170784302aaf09dd8f7889fefb
parent8a2d5f545ae1f76d08a6a6515f6b6c383cada5ad
signature Signed by PGP key B5690EEEBB952194

fix(web): disable linked pull requests when none are linked (#11348)


3 files changed, 14 insertions(+), 7 deletions(-)

apps/web/src/components/ChatView.tsx+10-5
......@@ -1,4 +1,5 @@
11import { useLoadBalancedEnvironment } from "../hooks/useLoadBalancedEnvironment";
2import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
23import type { UsageLimitSourceSnapshots } from "@t3tools/contracts";
34import {
45 collectProviderUsageLimits,
......@@ -4203,10 +4204,14 @@ export default function ChatView(props: ChatViewProps) {
42034204 }, [activeThreadRef]);
42044205 const supportsThreadPullRequests =
42054206 serverConfig?.environment.capabilities.threadPullRequests === true;
4207 const pullRequestsSurfaceAvailable =
4208 isServerThread &&
4209 supportsThreadPullRequests &&
4210 visibleThreadPullRequests((activeThreadShell ?? activeThread)?.pullRequests ?? []).length > 0;
42064211 const addPullRequestsSurface = useCallback(() => {
4207 if (!activeThreadRef || !supportsThreadPullRequests) return;
4212 if (!activeThreadRef || !pullRequestsSurfaceAvailable) return;
42084213 useRightPanelStore.getState().open(activeThreadRef, "pull-requests");
4209 }, [activeThreadRef, supportsThreadPullRequests]);
4214 }, [activeThreadRef, pullRequestsSurfaceAvailable]);
42104215 const { state: deviceState, loaded: deviceStateLoaded } = useDeviceState(
42114216 activeThreadRef?.environmentId ?? null,
42124217 );
......@@ -8340,7 +8345,7 @@ export default function ChatView(props: ChatViewProps) {
83408345 }
83418346 composerDraftTarget={composerDraftTarget}
83428347 onBack={
8343 activeThreadRef !== null && supportsThreadPullRequests
8348 activeThreadRef !== null && pullRequestsSurfaceAvailable
83448349 ? addPullRequestsSurface
83458350 : undefined
83468351 }
......@@ -8981,7 +8986,7 @@ export default function ChatView(props: ChatViewProps) {
89818986 diffAvailable={isServerThread && isGitRepo}
89828987 filesAvailable={activeProject !== null}
89838988 pullRequestAvailable={pullRequestSurfaceAvailable}
8984 pullRequestsAvailable={isServerThread && supportsThreadPullRequests}
8989 pullRequestsAvailable={pullRequestsSurfaceAvailable}
89858990 agentsAvailable
89868991 deviceAvailable={activeThreadRef !== null}
89878992 liveAgentCount={agentPanelModel.liveCount}
......@@ -9039,7 +9044,7 @@ export default function ChatView(props: ChatViewProps) {
90399044 diffAvailable={isServerThread && isGitRepo}
90409045 filesAvailable={activeProject !== null}
90419046 pullRequestAvailable={pullRequestSurfaceAvailable}
9042 pullRequestsAvailable={isServerThread && supportsThreadPullRequests}
9047 pullRequestsAvailable={pullRequestsSurfaceAvailable}
90439048 agentsAvailable
90449049 deviceAvailable={activeThreadRef !== null}
90459050 liveAgentCount={agentPanelModel.liveCount}
apps/web/src/components/CommandPalette.tsx+2
......@@ -1,6 +1,7 @@
11"use client";
22
33import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility";
4import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
45
56import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
67import {
......@@ -1708,6 +1709,7 @@ function OpenCommandPaletteDialog(props: {
17081709 value: "action:open-thread-pull-requests",
17091710 searchTerms: ["pull requests", "linked", "stack", "prs"],
17101711 title: "Show linked pull requests",
1712 disabled: visibleThreadPullRequests(activeThread.pullRequests).length === 0,
17111713 icon: <GitPullRequestArrowIcon className={ITEM_ICON_CLASS} />,
17121714 run: async () => {
17131715 useRightPanelStore.getState().open(threadRef, "pull-requests");
apps/web/src/components/RightPanelTabs.tsx+2-2
......@@ -154,7 +154,7 @@ const SURFACE_DISABLED_REASONS = {
154154 files: "Files are only available when a project is open.",
155155 diff: "Diff is only available for server threads in Git repositories.",
156156 pullRequest: "This thread's branch has no pull request yet.",
157 pullRequests: "Linked pull requests are only available for server threads.",
157 pullRequests: "No linked pull requests are available for this thread.",
158158 agents: "Agents are only available from a thread.",
159159 device: "Devices are only available from a thread.",
160160} as const;
......@@ -178,7 +178,7 @@ const SURFACE_UNAVAILABLE_HINTS = {
178178 files: "Available when a project is open.",
179179 diff: "Available for Git repositories.",
180180 pullRequest: "No pull request on this branch yet.",
181 pullRequests: "Available for server threads.",
181 pullRequests: "No linked pull requests available.",
182182 agents: "Available from a thread.",
183183 device: "Available from a thread.",
184184} as const;