mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-30 14:56:15 +00:00
tsgo 707->0; alias next-themes/next/* to browser stubs (kills blank-page crash); resolve [[.BaseHref]]/[[.Settings]] at build time; Dockerfile.site builds from source; [email protected].4 pin. Render-proven (Playwright, all routes, 0 ReferenceError).
22 lines
887 B
TypeScript
22 lines
887 B
TypeScript
// Browser stub for `next/link`, eagerly imported by the @hanzo/ui barrel
|
|
// (`import Link from 'next/link'`). o11y routes with react-router, not Next; this
|
|
// degrades to a plain <a>. Must resolve to a real module (aliased in vite.config.ts),
|
|
// never be externalized — a bare `next/link` specifier is unresolvable in the browser
|
|
// and crashes the SPA at load.
|
|
import { createElement, forwardRef } from 'react';
|
|
import type { AnchorHTMLAttributes, Ref } from 'react';
|
|
|
|
type LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
|
|
href?: string | { pathname?: string };
|
|
};
|
|
|
|
const Link = forwardRef(function Link(
|
|
{ href, children, ...rest }: LinkProps,
|
|
ref: Ref<HTMLAnchorElement>,
|
|
) {
|
|
const resolvedHref = typeof href === 'string' ? href : href?.pathname ?? '#';
|
|
return createElement('a', { ref, href: resolvedHref, ...rest }, children);
|
|
});
|
|
|
|
export default Link;
|