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 {
1717} from "@t3tools/contracts";
1818import { useNavigate } from "@tanstack/react-router";
1919import * 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";
2129import { flushSync } from "react-dom";
2230import {
2331 CheckIcon,
......@@ -91,7 +99,7 @@ import { resolvePathLinkTarget } from "~/terminal-links";
9199import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
92100import { readLocalApi } from "~/localApi";
93101import { getSourceControlPresentation } from "~/sourceControlPresentation";
94import { openPullRequestLink } from "~/lib/openPullRequestLink";
102import { openPullRequestLink, useOpenPrLink } from "~/lib/openPullRequestLink";
95103
96104interface GitActionsControlProps {
97105 gitCwd: string | null;
......@@ -995,6 +1003,7 @@ export default function GitActionsControl({
9951003 () => (activeThreadRef ? { threadRef: activeThreadRef } : undefined),
9961004 [activeThreadRef],
9971005 );
1006 const openPrLink = useOpenPrLink(activeThreadRef ?? undefined);
9981007 const activeDraftThread = useComposerDraftStore((store) =>
9991008 draftId
10001009 ? store.getDraftSession(draftId)
......@@ -1442,7 +1451,7 @@ export default function GitActionsControl({
14421451 const toastCta = actionResult.toast.cta;
14431452 let toastActionProps: {
14441453 children: string;
1445 onClick: () => void;
1454 onClick: (event: MouseEvent<HTMLButtonElement>) => void;
14461455 } | null = null;
14471456 if (toastCta.kind === "run_action") {
14481457 toastActionProps = {
......@@ -1457,11 +1466,9 @@ export default function GitActionsControl({
14571466 } else if (toastCta.kind === "open_pr") {
14581467 toastActionProps = {
14591468 children: toastCta.label,
1460 onClick: () => {
1461 const api = readLocalApi();
1462 if (!api) return;
1469 onClick: (event) => {
14631470 closeResultToast();
1464 void api.shell.openExternal(toastCta.url);
1471 openPrLink(event, toastCta.url);
14651472 },
14661473 };
14671474 }