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 @@...@@ -1,4 +1,5 @@
1import { useLoadBalancedEnvironment } from "../hooks/useLoadBalancedEnvironment";1import { useLoadBalancedEnvironment } from "../hooks/useLoadBalancedEnvironment";
2import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
2import type { UsageLimitSourceSnapshots } from "@t3tools/contracts";3import type { UsageLimitSourceSnapshots } from "@t3tools/contracts";
3import {4import {
4 collectProviderUsageLimits,5 collectProviderUsageLimits,
...@@ -4203,10 +4204,14 @@ export default function ChatView(props: ChatViewProps) {...@@ -4203,10 +4204,14 @@ export default function ChatView(props: ChatViewProps) {
4203 }, [activeThreadRef]);4204 }, [activeThreadRef]);
4204 const supportsThreadPullRequests =4205 const supportsThreadPullRequests =
4205 serverConfig?.environment.capabilities.threadPullRequests === true;4206 serverConfig?.environment.capabilities.threadPullRequests === true;
4207 const pullRequestsSurfaceAvailable =
4208 isServerThread &&
4209 supportsThreadPullRequests &&
4210 visibleThreadPullRequests((activeThreadShell ?? activeThread)?.pullRequests ?? []).length > 0;
4206 const addPullRequestsSurface = useCallback(() => {4211 const addPullRequestsSurface = useCallback(() => {
4207 if (!activeThreadRef || !supportsThreadPullRequests) return;4212 if (!activeThreadRef || !pullRequestsSurfaceAvailable) return;
4208 useRightPanelStore.getState().open(activeThreadRef, "pull-requests");4213 useRightPanelStore.getState().open(activeThreadRef, "pull-requests");
4209 }, [activeThreadRef, supportsThreadPullRequests]);4214 }, [activeThreadRef, pullRequestsSurfaceAvailable]);
4210 const { state: deviceState, loaded: deviceStateLoaded } = useDeviceState(4215 const { state: deviceState, loaded: deviceStateLoaded } = useDeviceState(
4211 activeThreadRef?.environmentId ?? null,4216 activeThreadRef?.environmentId ?? null,
4212 );4217 );
...@@ -8340,7 +8345,7 @@ export default function ChatView(props: ChatViewProps) {...@@ -8340,7 +8345,7 @@ export default function ChatView(props: ChatViewProps) {
8340 }8345 }
8341 composerDraftTarget={composerDraftTarget}8346 composerDraftTarget={composerDraftTarget}
8342 onBack={8347 onBack={
8343 activeThreadRef !== null && supportsThreadPullRequests8348 activeThreadRef !== null && pullRequestsSurfaceAvailable
8344 ? addPullRequestsSurface8349 ? addPullRequestsSurface
8345 : undefined8350 : undefined
8346 }8351 }
...@@ -8981,7 +8986,7 @@ export default function ChatView(props: ChatViewProps) {...@@ -8981,7 +8986,7 @@ export default function ChatView(props: ChatViewProps) {
8981 diffAvailable={isServerThread && isGitRepo}8986 diffAvailable={isServerThread && isGitRepo}
8982 filesAvailable={activeProject !== null}8987 filesAvailable={activeProject !== null}
8983 pullRequestAvailable={pullRequestSurfaceAvailable}8988 pullRequestAvailable={pullRequestSurfaceAvailable}
8984 pullRequestsAvailable={isServerThread && supportsThreadPullRequests}8989 pullRequestsAvailable={pullRequestsSurfaceAvailable}
8985 agentsAvailable8990 agentsAvailable
8986 deviceAvailable={activeThreadRef !== null}8991 deviceAvailable={activeThreadRef !== null}
8987 liveAgentCount={agentPanelModel.liveCount}8992 liveAgentCount={agentPanelModel.liveCount}
...@@ -9039,7 +9044,7 @@ export default function ChatView(props: ChatViewProps) {...@@ -9039,7 +9044,7 @@ export default function ChatView(props: ChatViewProps) {
9039 diffAvailable={isServerThread && isGitRepo}9044 diffAvailable={isServerThread && isGitRepo}
9040 filesAvailable={activeProject !== null}9045 filesAvailable={activeProject !== null}
9041 pullRequestAvailable={pullRequestSurfaceAvailable}9046 pullRequestAvailable={pullRequestSurfaceAvailable}
9042 pullRequestsAvailable={isServerThread && supportsThreadPullRequests}9047 pullRequestsAvailable={pullRequestsSurfaceAvailable}
9043 agentsAvailable9048 agentsAvailable
9044 deviceAvailable={activeThreadRef !== null}9049 deviceAvailable={activeThreadRef !== null}
9045 liveAgentCount={agentPanelModel.liveCount}9050 liveAgentCount={agentPanelModel.liveCount}
apps/web/src/components/CommandPalette.tsx+2
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1"use client";1"use client";
22
3import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility";3import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility";
4import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
45
5import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";6import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
6import {7import {
...@@ -1708,6 +1709,7 @@ function OpenCommandPaletteDialog(props: {...@@ -1708,6 +1709,7 @@ function OpenCommandPaletteDialog(props: {
1708 value: "action:open-thread-pull-requests",1709 value: "action:open-thread-pull-requests",
1709 searchTerms: ["pull requests", "linked", "stack", "prs"],1710 searchTerms: ["pull requests", "linked", "stack", "prs"],
1710 title: "Show linked pull requests",1711 title: "Show linked pull requests",
1712 disabled: visibleThreadPullRequests(activeThread.pullRequests).length === 0,
1711 icon: <GitPullRequestArrowIcon className={ITEM_ICON_CLASS} />,1713 icon: <GitPullRequestArrowIcon className={ITEM_ICON_CLASS} />,
1712 run: async () => {1714 run: async () => {
1713 useRightPanelStore.getState().open(threadRef, "pull-requests");1715 useRightPanelStore.getState().open(threadRef, "pull-requests");
apps/web/src/components/RightPanelTabs.tsx+2-2
...@@ -154,7 +154,7 @@ const SURFACE_DISABLED_REASONS = {...@@ -154,7 +154,7 @@ const SURFACE_DISABLED_REASONS = {
154 files: "Files are only available when a project is open.",154 files: "Files are only available when a project is open.",
155 diff: "Diff is only available for server threads in Git repositories.",155 diff: "Diff is only available for server threads in Git repositories.",
156 pullRequest: "This thread's branch has no pull request yet.",156 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.",
158 agents: "Agents are only available from a thread.",158 agents: "Agents are only available from a thread.",
159 device: "Devices are only available from a thread.",159 device: "Devices are only available from a thread.",
160} as const;160} as const;
...@@ -178,7 +178,7 @@ const SURFACE_UNAVAILABLE_HINTS = {...@@ -178,7 +178,7 @@ const SURFACE_UNAVAILABLE_HINTS = {
178 files: "Available when a project is open.",178 files: "Available when a project is open.",
179 diff: "Available for Git repositories.",179 diff: "Available for Git repositories.",
180 pullRequest: "No pull request on this branch yet.",180 pullRequest: "No pull request on this branch yet.",
181 pullRequests: "Available for server threads.",181 pullRequests: "No linked pull requests available.",
182 agents: "Available from a thread.",182 agents: "Available from a thread.",
183 device: "Available from a thread.",183 device: "Available from a thread.",
184} as const;184} as const;