From c727795a784abf90356de5136147274c2bcc13de Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Thu, 6 Aug 2026 08:12:16 +0200 Subject: [PATCH] Add ChunkLoadError boundary to force reload on stale deployment --- app/(dashboard)/error.tsx | 38 ++++++++++++++++++++++++++++++++++++++ app/global-error.tsx | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 app/(dashboard)/error.tsx create mode 100644 app/global-error.tsx diff --git a/app/(dashboard)/error.tsx b/app/(dashboard)/error.tsx new file mode 100644 index 0000000..126121a --- /dev/null +++ b/app/(dashboard)/error.tsx @@ -0,0 +1,38 @@ +"use client"; + +import { useEffect } from "react"; +import { Button } from "@/components/ui/button"; +import { AlertTriangle, RefreshCw } from "lucide-react"; + +export default function DashboardError({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + // After a redeployment the old chunk URLs 404 — force a hard reload to pick up new manifest + if (error?.name === "ChunkLoadError") { + window.location.reload(); + } + }, [error]); + + if (error?.name === "ChunkLoadError") { + return null; + } + + return ( +
Something went wrong
+ {error?.message && ( +{error.message}
+ )} + +Application error
+ {error?.digest && ( +Digest: {error.digest}
+ )} +