fix: keep inbox quicklook and tests standalone

This commit is contained in:
Dotta 2026-04-10 22:36:45 -05:00
parent dab95740be
commit 7ec8716159
4 changed files with 24 additions and 5 deletions

View file

@ -138,7 +138,6 @@ function makeRun(id: string, status: HeartbeatRun["status"], createdAt: string,
logCompressed: false, logCompressed: false,
errorCode: null, errorCode: null,
externalRunId: null, externalRunId: null,
processGroupId: null,
processPid: null, processPid: null,
processStartedAt: null, processStartedAt: null,
retryOfRunId: null, retryOfRunId: null,

View file

@ -22,6 +22,7 @@ function createLiveRun(overrides: Partial<LiveRunForIssue> = {}): LiveRunForIssu
function createActiveRun(overrides: Partial<ActiveRunForIssue> = {}): ActiveRunForIssue { function createActiveRun(overrides: Partial<ActiveRunForIssue> = {}): ActiveRunForIssue {
return { return {
id: "run-1", id: "run-1",
companyId: "company-1",
agentId: "agent-1", agentId: "agent-1",
agentName: "CodexCoder", agentName: "CodexCoder",
adapterType: "codex_local", adapterType: "codex_local",

View file

@ -2,12 +2,19 @@ import * as React from "react";
import * as RouterDom from "react-router-dom"; import * as RouterDom from "react-router-dom";
import type { NavigateOptions, To } from "react-router-dom"; import type { NavigateOptions, To } from "react-router-dom";
import { useCompany } from "@/context/CompanyContext"; import { useCompany } from "@/context/CompanyContext";
import { IssueLinkQuicklook } from "@/components/IssueLinkQuicklook";
import { import {
applyCompanyPrefix, applyCompanyPrefix,
extractCompanyPrefixFromPath, extractCompanyPrefixFromPath,
normalizeCompanyPrefix, normalizeCompanyPrefix,
} from "@/lib/company-routes"; } from "@/lib/company-routes";
function parseIssuePathIdFromPath(pathname: string | null | undefined): string | null {
if (!pathname) return null;
const match = pathname.match(/(?:^|\/)issues\/([^/?#]+)/);
return match?.[1] ?? null;
}
function resolveTo(to: To, companyPrefix: string | null): To { function resolveTo(to: To, companyPrefix: string | null): To {
if (typeof to === "string") { if (typeof to === "string") {
return applyCompanyPrefix(to, companyPrefix); return applyCompanyPrefix(to, companyPrefix);
@ -40,10 +47,23 @@ function useActiveCompanyPrefix(): string | null {
export * from "react-router-dom"; export * from "react-router-dom";
export const Link = React.forwardRef<HTMLAnchorElement, React.ComponentProps<typeof RouterDom.Link>>( type CompanyLinkProps = React.ComponentProps<typeof RouterDom.Link> & {
function CompanyLink({ to, ...props }, ref) { disableIssueQuicklook?: boolean;
};
export const Link = React.forwardRef<HTMLAnchorElement, CompanyLinkProps>(
function CompanyLink({ to, disableIssueQuicklook = false, ...props }, ref) {
const companyPrefix = useActiveCompanyPrefix(); const companyPrefix = useActiveCompanyPrefix();
return <RouterDom.Link ref={ref} to={resolveTo(to, companyPrefix)} {...props} />; const resolvedTo = resolveTo(to, companyPrefix);
const issuePathId = disableIssueQuicklook
? null
: parseIssuePathIdFromPath(typeof resolvedTo === "string" ? resolvedTo : resolvedTo.pathname);
if (issuePathId) {
return <IssueLinkQuicklook ref={ref} to={resolvedTo} issuePathId={issuePathId} {...props} />;
}
return <RouterDom.Link ref={ref} to={resolvedTo} {...props} />;
}, },
); );

View file

@ -98,7 +98,6 @@ describe("FailedRunInboxRow", () => {
logCompressed: false, logCompressed: false,
errorCode: null, errorCode: null,
externalRunId: null, externalRunId: null,
processGroupId: null,
processPid: null, processPid: null,
processStartedAt: null, processStartedAt: null,
retryOfRunId: null, retryOfRunId: null,