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 24, 12:45 UTC
fix(web): open PR toast actions in app (#9006)
eimexdev committed
Sep 2, 2026 at 00:34 UTC
43bafd4674841fb8782f5174033b684aa0d83f67
1 file changed
+14
-7
apps/web/src/components/GitActionsControl.tsx
+14
-7
@@ -17,7 +17,15 @@ import type {
17
} from "@t3tools/contracts";
18
import { useNavigate } from "@tanstack/react-router";
19
import * as Option from "effect/Option";
20
-import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
20
+import {
21
+ type MouseEvent,
22
+ useCallback,
23
+ useEffect,
24
+ useEffectEvent,
25
+ useMemo,
26
+ useRef,
27
+ useState,
28
+} from "react";
29
import { flushSync } from "react-dom";
30
import {
31
CheckIcon,
@@ -91,7 +99,7 @@ import { resolvePathLinkTarget } from "~/terminal-links";
99
import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
100
import { readLocalApi } from "~/localApi";
101
import { getSourceControlPresentation } from "~/sourceControlPresentation";
94
-import { openPullRequestLink } from "~/lib/openPullRequestLink";
102
+import { openPullRequestLink, useOpenPrLink } from "~/lib/openPullRequestLink";
103
104
interface GitActionsControlProps {
105
gitCwd: string | null;
@@ -995,6 +1003,7 @@ export default function GitActionsControl({
1003
() => (activeThreadRef ? { threadRef: activeThreadRef } : undefined),
1004
[activeThreadRef],
1005
);
1006
+ const openPrLink = useOpenPrLink(activeThreadRef ?? undefined);
1007
const activeDraftThread = useComposerDraftStore((store) =>
1008
draftId
1009
? store.getDraftSession(draftId)
@@ -1442,7 +1451,7 @@ export default function GitActionsControl({
1451
const toastCta = actionResult.toast.cta;
1452
let toastActionProps: {
1453
children: string;
1445
- onClick: () => void;
1454
+ onClick: (event: MouseEvent<HTMLButtonElement>) => void;
1455
} | null = null;
1456
if (toastCta.kind === "run_action") {
1457
toastActionProps = {
@@ -1457,11 +1466,9 @@ export default function GitActionsControl({
1466
} else if (toastCta.kind === "open_pr") {
1467
toastActionProps = {
1468
children: toastCta.label,
1460
- onClick: () => {
1461
- const api = readLocalApi();
1462
- if (!api) return;
1469
+ onClick: (event) => {
1470
closeResultToast();
1464
- void api.shell.openExternal(toastCta.url);
1471
+ openPrLink(event, toastCta.url);
1472
},
1473
};
1474
}