"use client"; import { isChunkLoadError, recoverByReload } from "@/app/chunk-recovery"; // Root error boundary for the whole app. Two jobs: // // 1. Self-heal stale-chunk failures. After a redeploy, an already-open tab // still references the previous build's chunk hashes; those 404 against the // new build and throw a ChunkLoadError when a route's code is loaded // (e.g. navigating to /agent/sessions). Without a boundary, Next.js shows a // dead "Application error" page. recoverByReload() reloads once (guarded) to // fetch the current build. // // 2. Give every other render error a friendly retry instead of a blank screen. // // NOTE: there is intentionally no useEffect — React effect hooks are banned // project-wide. The one-shot recovery runs from a ref callback (commit time), // which is idempotent thanks to the sessionStorage guard in recoverByReload(). export default function AppError({ error, reset, }: { error: Error & { digest?: string }; reset: () => void; }) { const chunkError = isChunkLoadError(error); return (
Updating to the latest version…
) : ( <>Something went wrong.
This view hit an unexpected error. You can retry it, or reload the app.