'use client'; import React, { useEffect, useState } from 'react'; import { RefreshCw, Home } from 'lucide-react'; interface GlobalErrorProps { error: Error & { digest?: string }; reset: () => void; } export default function GlobalError({ error, reset }: GlobalErrorProps) { const [isRetrying, setIsRetrying] = useState(false); useEffect(() => { console.error('Global error boundary caught:', error); const msg = (error?.message || '').toLowerCase(); const isChunkError = error?.name === 'ChunkLoadError' || msg.includes('loading chunk') || msg.includes('failed to fetch dynamically imported module'); if (isChunkError && typeof window !== 'undefined') { const retryKey = `chunk_reload_global_${window.location.pathname}`; if (!sessionStorage.getItem(retryKey)) { sessionStorage.setItem(retryKey, '1'); window.location.reload(); } } }, [error]); const handleRefresh = () => { setIsRetrying(true); if (typeof window !== 'undefined') { window.location.reload(); } else { reset(); } }; return (
Sorry for the inconvenience but we're performing some maintenance at the moment. If you need to you can always{' '} contact us , otherwise we'll be back online shortly!