fix: code splitting, route errors, Sentry CI source maps
CI / Build & Quality Checks (push) Successful in 10m20s
CI / Build & Quality Checks (push) Successful in 10m20s
- 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>
This commit is contained in:
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: npm run build
|
run: npm run build
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
SENTRY_AUTH_TOKEN: ''
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
VITE_APP_VERSION: ${{ github.sha }}
|
VITE_APP_VERSION: ${{ github.sha }}
|
||||||
|
|
||||||
# ── Quality checks (informational — pre-existing issues exist) ───────
|
# ── Quality checks (informational — pre-existing issues exist) ───────
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@ import { UserRoomProfileRenderer } from '../components/UserRoomProfileRenderer';
|
|||||||
import { HomeCreateRoom } from './client/home/CreateRoom';
|
import { HomeCreateRoom } from './client/home/CreateRoom';
|
||||||
import { Create } from './client/create';
|
import { Create } from './client/create';
|
||||||
import { getFallbackSession } from '../state/sessions';
|
import { getFallbackSession } from '../state/sessions';
|
||||||
|
import { RouteError } from './RouteError';
|
||||||
import { CallStatusRenderer } from './CallStatusRenderer';
|
import { CallStatusRenderer } from './CallStatusRenderer';
|
||||||
import { CallEmbedProvider } from '../components/CallEmbedProvider';
|
import { CallEmbedProvider } from '../components/CallEmbedProvider';
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize)
|
|||||||
const mobile = screenSize === ScreenSize.Mobile;
|
const mobile = screenSize === ScreenSize.Mobile;
|
||||||
|
|
||||||
const routes = createRoutesFromElements(
|
const routes = createRoutesFromElements(
|
||||||
<Route HydrateFallback={() => null}>
|
<Route HydrateFallback={() => null} errorElement={<RouteError />}>
|
||||||
<Route
|
<Route
|
||||||
index
|
index
|
||||||
loader={() => {
|
loader={() => {
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ import {
|
|||||||
PageHero,
|
PageHero,
|
||||||
PageHeroSection,
|
PageHeroSection,
|
||||||
} from '../../../components/page';
|
} from '../../../components/page';
|
||||||
import { CreateSpaceForm } from '../../../features/create-space';
|
|
||||||
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
||||||
|
|
||||||
|
const CreateSpaceForm = React.lazy(() =>
|
||||||
|
import('../../../features/create-space').then((m) => ({ default: m.CreateSpaceForm })),
|
||||||
|
);
|
||||||
|
|
||||||
export function Create() {
|
export function Create() {
|
||||||
const { navigateSpace } = useRoomNavigate();
|
const { navigateSpace } = useRoomNavigate();
|
||||||
|
|
||||||
@@ -26,7 +29,9 @@ export function Create() {
|
|||||||
title="Create Space"
|
title="Create Space"
|
||||||
subTitle="Build a space for your community."
|
subTitle="Build a space for your community."
|
||||||
/>
|
/>
|
||||||
<CreateSpaceForm onCreate={navigateSpace} />
|
<React.Suspense fallback={null}>
|
||||||
|
<CreateSpaceForm onCreate={navigateSpace} />
|
||||||
|
</React.Suspense>
|
||||||
</Box>
|
</Box>
|
||||||
</PageHeroSection>
|
</PageHeroSection>
|
||||||
</PageContentCenter>
|
</PageContentCenter>
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ import {
|
|||||||
} from '../../../components/page';
|
} from '../../../components/page';
|
||||||
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
||||||
import { BackRouteHandler } from '../../../components/BackRouteHandler';
|
import { BackRouteHandler } from '../../../components/BackRouteHandler';
|
||||||
import { CreateRoomForm } from '../../../features/create-room';
|
|
||||||
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
||||||
|
|
||||||
|
const CreateRoomForm = React.lazy(() =>
|
||||||
|
import('../../../features/create-room').then((m) => ({ default: m.CreateRoomForm })),
|
||||||
|
);
|
||||||
|
|
||||||
export function HomeCreateRoom() {
|
export function HomeCreateRoom() {
|
||||||
const screenSize = useScreenSizeContext();
|
const screenSize = useScreenSizeContext();
|
||||||
|
|
||||||
@@ -44,7 +47,9 @@ export function HomeCreateRoom() {
|
|||||||
title="Create Room"
|
title="Create Room"
|
||||||
subTitle="Build a Room for Real-Time Conversations."
|
subTitle="Build a Room for Real-Time Conversations."
|
||||||
/>
|
/>
|
||||||
<CreateRoomForm onCreate={navigateRoom} />
|
<React.Suspense fallback={null}>
|
||||||
|
<CreateRoomForm onCreate={navigateRoom} />
|
||||||
|
</React.Suspense>
|
||||||
</Box>
|
</Box>
|
||||||
</PageHeroSection>
|
</PageHeroSection>
|
||||||
</PageContentCenter>
|
</PageContentCenter>
|
||||||
|
|||||||
Reference in New Issue
Block a user