@devries-cameron20 / t3code Mirror · read-only / commits / 0702c6fdca
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

fix(web): Open on GitHub in a thread's PR panel honors 'Open links in' (#39856)

Julius Marminge committed Nov 20, 2026 at 11:56 UTC 0702c6fdcabd70ca6c5a765bc744a24989979540
4 files changed +20 -4
apps/web/src/components/pullRequest/PullRequestActionsMenu.browser.test.tsx
+2
@@ -24,6 +24,7 @@ vi.mock(import("~/state/server"), async () => {
24 const { Atom } = await import("effect/reactivity");
25 return { primaryServerKeybindingsAtom: Atom.make([]) } as never;
26 });
27 +vi.mock(import("~/browser/useOpenLink"), () => ({ useOpenLink: () => async () => {} }));
28 vi.mock(import("./PullRequestThreadLinks"), () => ({ PullRequestThreadLinks: () => null }));
29 vi.mock(
30 import("./PullRequestDetailActions"),
@@ -75,6 +76,7 @@ function setup() {
76 pullRequestKey="owner/repo/7"
77 detail={detail}
78 terminology={sourceControlClients.get("github").changeRequest}
79 + threadRef={null}
80 linkThreadRef={null}
81 onThreadPickerOpenChange={() => {}}
82 refreshing={false}
apps/web/src/components/pullRequest/PullRequestActionsMenu.tsx
+5 -2
@@ -29,10 +29,10 @@ import {
29 import { Branch, msg, T, useGT, useMessages } from "gt-react";
30 import { useId, useState } from "react";
31
32 +import { useOpenLink } from "~/browser/useOpenLink";
33 import { m } from "~/i18n/messages";
34
35 import { shortcutLabelForCommand } from "~/keybindings";
35 -import { readLocalApi } from "~/localApi";
36 import { pullRequestEnvironment } from "~/state/pullRequests";
37 import { primaryServerKeybindingsAtom } from "~/state/server";
38 import { useAtomCommand } from "~/state/use-atom-command";
@@ -71,6 +71,7 @@ export function PullRequestActionsMenu({
71 pullRequestKey,
72 detail,
73 terminology,
74 + threadRef,
75 linkThreadRef,
76 onThreadPickerOpenChange,
77 refreshing,
@@ -123,6 +124,7 @@ export function PullRequestActionsMenu({
124 | "observedAt"
125 >;
126 terminology: ChangeRequestTerminology;
127 + threadRef: ScopedThreadRef | null;
128 linkThreadRef: ScopedThreadRef | null;
129 onThreadPickerOpenChange: (open: boolean) => void;
130 refreshing: boolean;
@@ -161,6 +163,7 @@ export function PullRequestActionsMenu({
163 copyReference: (value: string, failureTitle: string) => void;
164 }) {
165 const gt = useGT();
166 + const openLink = useOpenLink(threadRef);
167 const resolve = useMessages();
168 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
169 const inlineConfirm = useInlineActionConfirm(pullRequestKey);
@@ -434,7 +437,7 @@ export function PullRequestActionsMenu({
437 ) : null}
438 </>
439 ) : null}
437 - <MenuItem onClick={() => void readLocalApi()?.shell.openExternal(detail.url)}>
440 + <MenuItem onClick={(event) => void openLink(detail.url, { event }).catch(console.error)}>
441 <ArrowUpRightIcon className="size-3.5" />
442 {openOnHostText}
443 </MenuItem>
apps/web/src/components/pullRequest/PullRequestDetailCrumbs.tsx
+11 -2
@@ -1,8 +1,10 @@
1 +import type { ScopedThreadRef } from "@t3tools/contracts";
2 import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
3 import { T, useGT } from "gt-react";
4 import { ArrowLeftIcon, ExternalLinkIcon } from "lucide-react";
5 import type { MouseEvent as ReactMouseEvent } from "react";
6
7 +import { useOpenLink } from "~/browser/useOpenLink";
8 import { cn } from "~/lib/utils";
9 import { readLocalApi } from "~/localApi";
10 import { Button } from "../ui/button";
@@ -59,16 +61,19 @@ function BackButton({ onBack, focusable }: { onBack: () => void; focusable: bool
61
62 function NumberLink({
63 detail,
64 + threadRef,
65 toneClassName,
66 openOnHostText,
67 focusable,
68 }: {
69 detail: CrumbsPullRequest;
70 + threadRef: ScopedThreadRef | null;
71 toneClassName: string;
72 openOnHostText: string;
73 focusable: boolean;
74 }) {
75 const gt = useGT();
76 + const openLink = useOpenLink(threadRef);
77 return (
78 <Tooltip>
79 <TooltipTrigger
@@ -76,9 +81,9 @@ function NumberLink({
81 <button
82 type="button"
83 {...(focusable ? {} : { tabIndex: -1 })}
79 - onClick={() => void readLocalApi()?.shell.openExternal(detail.url)}
84 + onClick={(event) => void openLink(detail.url, { event }).catch(console.error)}
85 onAuxClick={(event) => {
81 - if (event.button === 1) void readLocalApi()?.shell.openExternal(detail.url);
86 + if (event.button === 1) void openLink(detail.url, { event }).catch(console.error);
87 }}
88 onContextMenu={(event) => openNumberContextMenu(event, detail)}
89 className={cn(
@@ -111,6 +116,7 @@ function NumberLink({
116 */
117 export function PullRequestDetailCrumbs({
118 detail,
119 + threadRef,
120 toneClassName,
121 condensed,
122 repositoryUrl,
@@ -118,6 +124,7 @@ export function PullRequestDetailCrumbs({
124 onBack,
125 }: {
126 detail: CrumbsPullRequest | null;
127 + threadRef: ScopedThreadRef | null;
128 toneClassName: string | null;
129 condensed: boolean;
130 repositoryUrl: string | null;
@@ -168,6 +175,7 @@ export function PullRequestDetailCrumbs({
175 </Tooltip>
176 <NumberLink
177 detail={detail}
178 + threadRef={threadRef}
179 toneClassName={toneClassName}
180 openOnHostText={openOnHostText}
181 focusable
@@ -191,6 +199,7 @@ export function PullRequestDetailCrumbs({
199 {onBack ? <BackButton onBack={onBack} focusable={condensed} /> : null}
200 <NumberLink
201 detail={detail}
202 + threadRef={threadRef}
203 toneClassName={toneClassName}
204 openOnHostText={openOnHostText}
205 focusable={condensed}
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+2
@@ -1567,6 +1567,7 @@ export function PullRequestDetailPanel({
1567 >
1568 <PullRequestDetailCrumbs
1569 detail={detail}
1570 + threadRef={threadRef}
1571 toneClassName={statePresentation?.toneClassName ?? null}
1572 condensed={condensed}
1573 repositoryUrl={repositoryUrl}
@@ -1631,6 +1632,7 @@ export function PullRequestDetailPanel({
1632 pullRequestKey={pullRequestKey}
1633 detail={detail}
1634 terminology={terminology}
1635 + threadRef={threadRef}
1636 linkThreadRef={
1637 threadRef ??
1638 (typeof composerDraftTarget === "object" ? composerDraftTarget : null)