Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(web): open modified PR clicks in browser (#6278)
t3-code[bot]8d24b5131f43
diff --git a/apps/web/src/lib/openPullRequestLink.test.ts b/apps/web/src/lib/openPullRequestLink.test.tsindex a08b992bb..9d26fa292 100644--- a/apps/web/src/lib/openPullRequestLink.test.ts+++ b/apps/web/src/lib/openPullRequestLink.test.ts@@ -5,6 +5,7 @@ import {openPullRequestLink,parseChangeRequestUrl,PullRequestLinkOpenError,+ shouldOpenPullRequestExternally,} from "./openPullRequestLink";describe("openPullRequestLink", () => {@@ -34,6 +35,17 @@ describe("openPullRequestLink", () => {});});+describe("shouldOpenPullRequestExternally", () => {+ it("uses the browser for command-click and control-click", () => {+ expect(shouldOpenPullRequestExternally({ metaKey: true, ctrlKey: false })).toBe(true);+ expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: true })).toBe(true);+ });++ it("keeps an unmodified click in the pull request view", () => {+ expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: false })).toBe(false);+ });+});+describe("parseChangeRequestUrl", () => {it("reads a GitHub pull request", () => {expect(parseChangeRequestUrl("https://github.com/T3Tools/T3Code/pull/123")).toEqual({diff --git a/apps/web/src/lib/openPullRequestLink.ts b/apps/web/src/lib/openPullRequestLink.tsindex 951c02e4b..8943f907b 100644--- a/apps/web/src/lib/openPullRequestLink.ts+++ b/apps/web/src/lib/openPullRequestLink.ts@@ -173,10 +173,19 @@ export function findProjectForChangeRequest(* should still be reading it afterwards. Any change request opens there, not only the thread's* own, since the panel is told which one to show.*/+export function shouldOpenPullRequestExternally(+ event: Pick<MouseEvent<HTMLElement>, "metaKey" | "ctrlKey">,+): boolean {+ return event.metaKey || event.ctrlKey;+}+export function useOpenChangeRequestLink(threadRef?: ScopedThreadRef,): (- event: Pick<MouseEvent<HTMLElement>, "preventDefault" | "stopPropagation">,+ event: Pick<+ MouseEvent<HTMLElement>,+ "preventDefault" | "stopPropagation" | "metaKey" | "ctrlKey"+ >,targetUrl: string,targetThreadRef?: ScopedThreadRef,) => boolean {@@ -186,6 +195,7 @@ export function useOpenChangeRequestLink(const primaryEnvironmentId = usePrimaryEnvironmentId();return useCallback((event, targetUrl, targetThreadRef) => {+ if (shouldOpenPullRequestExternally(event)) return false;const resolvedThreadRef = targetThreadRef ?? threadRef;const environmentId = resolvedThreadRef?.environmentId ?? primaryEnvironmentId;if (