From d0c3649cf3a8dd36117dcc7bf67d89d448966550 Mon Sep 17 00:00:00 2001 From: nxtkofi Date: Tue, 21 Apr 2026 23:27:24 +0200 Subject: [PATCH] feat(ux): add locale error boundary and retry flow Add error.tsx with retry support and QA route for testing Co-authored-by: Sisyphus --- src/app/[locale]/error.tsx | 51 ++++++++++++++++++++++++ src/app/[locale]/qa/route-error/page.tsx | 5 +++ 2 files changed, 56 insertions(+) create mode 100644 src/app/[locale]/error.tsx create mode 100644 src/app/[locale]/qa/route-error/page.tsx diff --git a/src/app/[locale]/error.tsx b/src/app/[locale]/error.tsx new file mode 100644 index 0000000..bdf10cc --- /dev/null +++ b/src/app/[locale]/error.tsx @@ -0,0 +1,51 @@ +"use client"; + +import { useTranslations } from "next-intl"; +import { Button } from "@/components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +interface ErrorProps { + error: Error & { digest?: string }; + reset: () => void; +} + +export default function Error({ error, reset }: ErrorProps) { + const t = useTranslations("Fallback.Error"); + + const handleRetry = () => { + if (typeof window !== "undefined" && "unstable_retry" in window.location) { + (window.location as unknown as { unstable_retry: () => void }).unstable_retry(); + } else { + reset(); + } + }; + + return ( +
+ + + {t("Title")} + {t("Description")} + + + + + +
+ ); +} diff --git a/src/app/[locale]/qa/route-error/page.tsx b/src/app/[locale]/qa/route-error/page.tsx new file mode 100644 index 0000000..0588523 --- /dev/null +++ b/src/app/[locale]/qa/route-error/page.tsx @@ -0,0 +1,5 @@ +"use client"; + +export default function RouteErrorPage() { + throw new Error("Intentional error for QA testing - this should trigger the error boundary"); +}