fix: stabilize presenter route loading
This commit is contained in:
@@ -205,7 +205,10 @@ describe("App", () => {
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
expect(await screen.findByRole("main", { name: /lda.chat presenter notes/i })).toBeInTheDocument();
|
||||
expect(
|
||||
await screen.findByRole("main", { name: /lda.chat presenter notes/i }, { timeout: 5_000 }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { level: 1 })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("main", { name: /lda.chat presentation/i })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,12 +7,18 @@ const PresenterRoute = lazy(() => import("../presentation/presenter/PresenterRou
|
||||
default: module.PresenterRoute,
|
||||
})));
|
||||
|
||||
const PresenterRouteFallback = () => (
|
||||
<main className="presenter-route" aria-label="Presenter notes loading" aria-busy="true">
|
||||
<p>Loading presenter notes...</p>
|
||||
</main>
|
||||
);
|
||||
|
||||
export const AppRoutes = () => (
|
||||
<Routes>
|
||||
<Route path="/" element={<ConsoleHome />} />
|
||||
<Route path="/console" element={<ConsoleHome />} />
|
||||
<Route path="/present" element={<PresentationRoute />} />
|
||||
<Route path="/presenter" element={<Suspense fallback={null}><PresenterRoute /></Suspense>} />
|
||||
<Route path="/presenter" element={<Suspense fallback={<PresenterRouteFallback />}><PresenterRoute /></Suspense>} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user