fix: keep thread polish independent of quicklook routing

This commit is contained in:
Dotta
2026-04-10 22:36:45 -05:00
parent 958c11699e
commit dc94e3d1df
+3 -18
View File
@@ -2,13 +2,11 @@ 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";
import { parseIssuePathIdFromPath } from "@/lib/issue-reference";
function resolveTo(to: To, companyPrefix: string | null): To {
if (typeof to === "string") {
@@ -42,23 +40,10 @@ function useActiveCompanyPrefix(): string | null {
export * from "react-router-dom";
type CompanyLinkProps = React.ComponentProps<typeof RouterDom.Link> & {
disableIssueQuicklook?: boolean;
};
export const Link = React.forwardRef<HTMLAnchorElement, CompanyLinkProps>(
function CompanyLink({ to, disableIssueQuicklook = false, ...props }, ref) {
export const Link = React.forwardRef<HTMLAnchorElement, React.ComponentProps<typeof RouterDom.Link>>(
function CompanyLink({ to, ...props }, ref) {
const companyPrefix = useActiveCompanyPrefix();
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} />;
return <RouterDom.Link ref={ref} to={resolveTo(to, companyPrefix)} {...props} />;
},
);