authorgravatar for 130890337+eimexdev@users.noreply.github.comeimexdev <130890337+eimexdev@users.noreply.github.com> 2026-09-02 00:34:39-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-02 01:34:39-04:00
log43bafd4674841fb8782f5174033b684aa0d83f67
tree18f47e815a5c678bf502e577a433b5f8047f5a41
parent8339508f5c244a63a845004393d7d9e701152d6e
signature Signed by PGP key B5690EEEBB952194

fix(web): open PR toast actions in app (#9006)


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

apps/web/src/components/GitActionsControl.tsx+14-7
...@@ -17,7 +17,15 @@ import type {...@@ -17,7 +17,15 @@ import type {
17} from "@t3tools/contracts";17} from "@t3tools/contracts";
18import { useNavigate } from "@tanstack/react-router";18import { useNavigate } from "@tanstack/react-router";
19import * as Option from "effect/Option";19import * as Option from "effect/Option";
20import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";20import {
21 type MouseEvent,
22 useCallback,
23 useEffect,
24 useEffectEvent,
25 useMemo,
26 useRef,
27 useState,
28} from "react";
21import { flushSync } from "react-dom";29import { flushSync } from "react-dom";
22import {30import {
23 CheckIcon,31 CheckIcon,
...@@ -91,7 +99,7 @@ import { resolvePathLinkTarget } from "~/terminal-links";...@@ -91,7 +99,7 @@ import { resolvePathLinkTarget } from "~/terminal-links";
91import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";99import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
92import { readLocalApi } from "~/localApi";100import { readLocalApi } from "~/localApi";
93import { getSourceControlPresentation } from "~/sourceControlPresentation";101import { getSourceControlPresentation } from "~/sourceControlPresentation";
94import { openPullRequestLink } from "~/lib/openPullRequestLink";102import { openPullRequestLink, useOpenPrLink } from "~/lib/openPullRequestLink";
95103
96interface GitActionsControlProps {104interface GitActionsControlProps {
97 gitCwd: string | null;105 gitCwd: string | null;
...@@ -995,6 +1003,7 @@ export default function GitActionsControl({...@@ -995,6 +1003,7 @@ export default function GitActionsControl({
995 () => (activeThreadRef ? { threadRef: activeThreadRef } : undefined),1003 () => (activeThreadRef ? { threadRef: activeThreadRef } : undefined),
996 [activeThreadRef],1004 [activeThreadRef],
997 );1005 );
1006 const openPrLink = useOpenPrLink(activeThreadRef ?? undefined);
998 const activeDraftThread = useComposerDraftStore((store) =>1007 const activeDraftThread = useComposerDraftStore((store) =>
999 draftId1008 draftId
1000 ? store.getDraftSession(draftId)1009 ? store.getDraftSession(draftId)
...@@ -1442,7 +1451,7 @@ export default function GitActionsControl({...@@ -1442,7 +1451,7 @@ export default function GitActionsControl({
1442 const toastCta = actionResult.toast.cta;1451 const toastCta = actionResult.toast.cta;
1443 let toastActionProps: {1452 let toastActionProps: {
1444 children: string;1453 children: string;
1445 onClick: () => void;1454 onClick: (event: MouseEvent<HTMLButtonElement>) => void;
1446 } | null = null;1455 } | null = null;
1447 if (toastCta.kind === "run_action") {1456 if (toastCta.kind === "run_action") {
1448 toastActionProps = {1457 toastActionProps = {
...@@ -1457,11 +1466,9 @@ export default function GitActionsControl({...@@ -1457,11 +1466,9 @@ export default function GitActionsControl({
1457 } else if (toastCta.kind === "open_pr") {1466 } else if (toastCta.kind === "open_pr") {
1458 toastActionProps = {1467 toastActionProps = {
1459 children: toastCta.label,1468 children: toastCta.label,
1460 onClick: () => {1469 onClick: (event) => {
1461 const api = readLocalApi();
1462 if (!api) return;
1463 closeResultToast();1470 closeResultToast();
1464 void api.shell.openExternal(toastCta.url);1471 openPrLink(event, toastCta.url);
1465 },1472 },
1466 };1473 };
1467 }1474 }