Wrap next/link in a shared Link component that ships prefetch=false by default, so no route is ever prefetched (viewport or hover) anymore, and drop the DNS prefetch hint. Removes hidden background requests that were the source of intermittent issues.
58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { Home, RefreshCw } from "lucide-react";
|
|
import { useTranslations } from "next-intl";
|
|
import { useEffect } from "react";
|
|
import { ErrorScreen } from "@/components/error-screen";
|
|
import Link from "@/components/link";
|
|
|
|
/**
|
|
* Site route-segment error boundary. Renders inside the site shell layout.
|
|
* Never shows the raw error to the user.
|
|
*/
|
|
export default function SiteErrorPage({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
const t = useTranslations("pages.error");
|
|
|
|
useEffect(() => {
|
|
console.error(error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<ErrorScreen
|
|
code={t("code")}
|
|
title={t("title")}
|
|
subtitle={t("subtitle")}
|
|
body={t("body")}
|
|
actions={
|
|
<>
|
|
<button
|
|
type="button"
|
|
className="btn btn-primary"
|
|
onClick={() => reset()}
|
|
>
|
|
<RefreshCw className="error-screen-btn-icon" aria-hidden />
|
|
{t("tryAgain")}
|
|
</button>
|
|
<Link className="btn btn-outline" href="/">
|
|
<Home className="error-screen-btn-icon" aria-hidden />
|
|
{t("backHome")}
|
|
</Link>
|
|
</>
|
|
}
|
|
footer={
|
|
error.digest ? (
|
|
<p className="error-screen-digest">
|
|
{t("reference", { digest: error.digest })}
|
|
</p>
|
|
) : null
|
|
}
|
|
/>
|
|
);
|
|
}
|