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
-1
View File
@@ -138,7 +138,6 @@ function makeRun(id: string, status: HeartbeatRun["status"], createdAt: string,
logCompressed: false,
errorCode: null,
externalRunId: null,
processGroupId: null,
processPid: null,
processStartedAt: null,
retryOfRunId: null,
+1
View File
@@ -22,6 +22,7 @@ function createLiveRun(overrides: Partial<LiveRunForIssue> = {}): LiveRunForIssu
function createActiveRun(overrides: Partial<ActiveRunForIssue> = {}): ActiveRunForIssue {
return {
id: "run-1",
companyId: "company-1",
agentId: "agent-1",
agentName: "CodexCoder",
adapterType: "codex_local",
+23 -3
View File
@@ -2,12 +2,19 @@ import * as React from "react";
import * as RouterDom from "react-router-dom";
import type { NavigateOptions, To } from "react-router-dom";
import { useCompany } from "@/context/CompanyContext";
import { IssueLinkQuicklook } from "@/components/IssueLinkQuicklook";
import {
applyCompanyPrefix,
extractCompanyPrefixFromPath,
normalizeCompanyPrefix,
} 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 {
if (typeof to === "string") {
return applyCompanyPrefix(to, companyPrefix);
@@ -40,10 +47,23 @@ function useActiveCompanyPrefix(): string | null {
export * from "react-router-dom";
export const Link = React.forwardRef<HTMLAnchorElement, React.ComponentProps<typeof RouterDom.Link>>(
function CompanyLink({ to, ...props }, ref) {
type CompanyLinkProps = React.ComponentProps<typeof RouterDom.Link> & {
disableIssueQuicklook?: boolean;
};
export const Link = React.forwardRef<HTMLAnchorElement, CompanyLinkProps>(
function CompanyLink({ to, disableIssueQuicklook = false, ...props }, ref) {
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} />;
},
);
-1
View File
@@ -98,7 +98,6 @@ describe("FailedRunInboxRow", () => {
logCompressed: false,
errorCode: null,
externalRunId: null,
processGroupId: null,
processPid: null,
processStartedAt: null,
retryOfRunId: null,