3927f01089
- Lazy-import CreateRoomForm/CreateSpaceForm in CreateRoom.tsx and Create.tsx so create-room and create-space get their own chunks; eliminates INEFFECTIVE_DYNAMIC_IMPORT warnings - Add RouteError component wired to root route errorElement so crashes show a reload button instead of React Router dev screen - ci.yml: use secrets.SENTRY_AUTH_TOKEN so source maps upload on CI builds Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { useRouteError, isRouteErrorResponse } from 'react-router-dom';
|
|
|
|
export function RouteError() {
|
|
const error = useRouteError();
|
|
|
|
const message = isRouteErrorResponse(error)
|
|
? `${error.status} ${error.statusText}`
|
|
: error instanceof Error
|
|
? error.message
|
|
: 'An unexpected error occurred.';
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
height: '100dvh',
|
|
gap: '16px',
|
|
padding: '32px',
|
|
fontFamily: 'sans-serif',
|
|
}}
|
|
>
|
|
<h2 style={{ margin: 0, fontSize: '1.25rem' }}>Something went wrong</h2>
|
|
<p style={{ margin: 0, opacity: 0.7, textAlign: 'center' }}>{message}</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => window.location.reload()}
|
|
style={{
|
|
padding: '8px 20px',
|
|
borderRadius: '8px',
|
|
border: 'none',
|
|
cursor: 'pointer',
|
|
fontWeight: 600,
|
|
}}
|
|
>
|
|
Reload
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|