'use client'; import { FluentEmoji } from '@bentwnghk/ui'; import { Button } from 'antd'; import Link from 'next/link'; import { memo, useLayoutEffect, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; import { MAX_WIDTH } from '@/const/layoutTokens'; import { type ErrorType, sentryCaptureException } from './sentryCaptureException'; interface ErrorCaptureProps { error: ErrorType; reset: () => void; } const ErrorCapture = memo(({ reset, error }) => { const { t } = useTranslation('error'); useLayoutEffect(() => { sentryCaptureException(error); }, [error]); useEffect(() => { const timer = setTimeout(() => { window.location.reload(); }, 100); return () => clearTimeout(timer); // Cleanup the timeout on unmount }, []); // Empty dependency array to run only once on mount const handleReset = () => { reset(); // Call the provided reset function window.location.reload(); // Reload the page }; return (

ERROR

{t('error.title')}

{t('error.desc')}

); }); ErrorCapture.displayName = 'ErrorCapture'; export default ErrorCapture;