"use client"; import { useEffect } from "react"; import { RefreshCw } from "lucide-react"; import { useT } from "@/components/I18n"; import { isStaleAction, reportStaleAction } from "@/components/StaleActionGuard"; /** * PEP-324: the error boundary of every page. Before it a failed form action (most often a button of a * page opened before an update) left the person with Next's «Application error». An unknown action is * handed to StaleActionGuard (keep the text, say FORGE was updated, reload); any other error gets a * plain screen — React still writes it to console.error, so it reaches «Ошибки из прода». */ export default function PageError({ error }: { error: Error & { digest?: string } }) { const t = useT(); const stale = isStaleAction(error); useEffect(() => { if (stale) reportStaleAction(); }, [stale]); if (stale) return null; return (
{t("Страница не открылась из-за ошибки.")}
{t("Обновите страницу или вернитесь назад.")}