Fix missing suspenses in routing

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-03-14 11:39:24 +04:00
parent 9d174bb462
commit ac7fa6edb3
2 changed files with 240 additions and 244 deletions

View File

@@ -63,48 +63,9 @@ function App() {
<HelmetProvider> <HelmetProvider>
<BrowserRouter> <BrowserRouter>
<Routes> <Routes>
{/* Authentication Routes - Accessible without login */} <Route path="/*">
<Route <Route
element={ index
<ErrorBoundaryWithLocation>
<AuthLayout />
</ErrorBoundaryWithLocation>
}
>
<Route
path="login"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<LoginPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
<Route
path="register"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<RegisterPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
<Route
path="confirm-email"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<ConfirmEmailPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
</Route>
<Route
path="/"
element={ element={
<Suspense> <Suspense>
<ErrorBoundaryWithLocation> <ErrorBoundaryWithLocation>
@@ -114,15 +75,7 @@ function App() {
} }
/> />
<Route <Route path="*" element={<ConsoleLayout />}>
element={
<Suspense>
<ErrorBoundaryWithLocation>
<ConsoleLayout />
</ErrorBoundaryWithLocation>
</Suspense>
}
>
<Route path="organizations"> <Route path="organizations">
<Route <Route
path="create" path="create"
@@ -320,14 +273,54 @@ function App() {
</Route> </Route>
</Route> </Route>
{/* Authentication Routes - Accessible without login */}
<Route
element={
<ErrorBoundaryWithLocation>
<AuthLayout />
</ErrorBoundaryWithLocation>
}
>
<Route
path="login"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<LoginPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
<Route
path="register"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<RegisterPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
<Route
path="confirm-email"
element={
<Suspense>
<ErrorBoundaryWithLocation>
<ConfirmEmailPage />
</ErrorBoundaryWithLocation>
</Suspense>
}
/>
</Route>
<Route <Route
path="*"
element={ element={
<Suspense> <Suspense>
<NotFoundPage /> <NotFoundPage />
</Suspense> </Suspense>
} }
/> />
</Route>
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>
</HelmetProvider> </HelmetProvider>

View File

@@ -368,7 +368,9 @@ function BreadcrumbUpdatePolicy() {
export default function ConsoleLayout() { export default function ConsoleLayout() {
return ( return (
<SidebarProvider> <SidebarProvider>
<Suspense>
<AppSidebar /> <AppSidebar />
</Suspense>
<SidebarInset> <SidebarInset>
<header className="flex h-16 shrink-0 items-center gap-2"> <header className="flex h-16 shrink-0 items-center gap-2">
<div className="flex items-center gap-2 px-4"> <div className="flex items-center gap-2 px-4">
@@ -467,6 +469,7 @@ export default function ConsoleLayout() {
} }
/> />
</Route> </Route>
<Route path="*" element={<BreadcrumbHome />}> <Route path="*" element={<BreadcrumbHome />}>
<Route <Route
path="create" path="create"