'use client'; import React, { useEffect, useState } from 'react'; import { RefreshCw, Home, ChevronDown } from 'lucide-react'; import Link from 'next/link'; interface ErrorProps { error: Error & { digest?: string }; reset: () => void; } export default function Error({ error, reset }: ErrorProps) { const [isRetrying, setIsRetrying] = useState(false); const [showDetails, setShowDetails] = useState(false); useEffect(() => { console.error('Storefront error boundary caught:', error); // Auto-recover from chunk load errors caused by production redeployments 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_${window.location.pathname}`; const hasRetried = sessionStorage.getItem(retryKey); if (!hasRetried) { 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!
— The iFixKart Team
{/* Action Buttons */} {/* Technical Diagnostics (Collapsible for dev & debugging) */} {error?.message && ({error.name || 'Error'}: {error.message}
{error.digest &&Digest: {error.digest}
}