Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions frontend/src/components/error/LazyOutlet/LazyOutlet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Center the route-loading fallback in the content area. */
.lazyOutletFallback {
display: flex;
width: 100%;
min-height: 60vh;
align-items: center;
justify-content: center;
}

/* GenericLoader's .center uses `width/height: inherit`, which collapses to a
narrow column inside the flex content area (the loader text ends up wrapping
one word per line next to the sidebar). Pin it to the full fallback width so
it renders centered at its natural size instead. */
.lazyOutletFallback > .center {
width: 100%;
height: auto;
}
11 changes: 10 additions & 1 deletion frontend/src/components/error/LazyOutlet/LazyOutlet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Outlet, useLocation } from "react-router-dom";

import { GenericLoader } from "../../generic-loader/GenericLoader.jsx";
import { ErrorBoundary } from "../../widgets/error-boundary/ErrorBoundary.jsx";
import "./LazyOutlet.css";

// A failed dynamic import — almost always a stale hashed chunk after a
// redeploy (the client's index.html references a filename the CDN no longer
Expand Down Expand Up @@ -74,7 +75,15 @@ export function LazyOutlet() {
onError={handleRouteError}
fallbackComponent={<RouteLoadError />}
>
<Suspense fallback={<GenericLoader />}>
{/* Wrap the loader so it fills the content area and stays centered — see
LazyOutlet.css for why GenericLoader needs this here. */}
<Suspense
fallback={
<div className="lazyOutletFallback">
<GenericLoader />
</div>
}
>
<Outlet />
</Suspense>
</ErrorBoundary>
Expand Down