Skip to content

Commit a1c8cde

Browse files
authored
UN-3185: Fix squished route-loading spinner in the content area (#2118)
GenericLoader's .center uses width/height: inherit, which collapsed to a narrow column when used as LazyOutlet's content-area Suspense fallback (the loader text wrapped one word per line beside the sidebar). Wrap the fallback in a full-width, flex-centered .lazyOutletFallback box and pin .center to width:100% so it renders centered at its natural size. The top-level loader in Router.jsx is unaffected (it doesn't use this wrapper).
1 parent b13e5bd commit a1c8cde

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Center the route-loading fallback in the content area. */
2+
.lazyOutletFallback {
3+
display: flex;
4+
width: 100%;
5+
min-height: 60vh;
6+
align-items: center;
7+
justify-content: center;
8+
}
9+
10+
/* GenericLoader's .center uses `width/height: inherit`, which collapses to a
11+
narrow column inside the flex content area (the loader text ends up wrapping
12+
one word per line next to the sidebar). Pin it to the full fallback width so
13+
it renders centered at its natural size instead. */
14+
.lazyOutletFallback > .center {
15+
width: 100%;
16+
height: auto;
17+
}

frontend/src/components/error/LazyOutlet/LazyOutlet.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Outlet, useLocation } from "react-router-dom";
44

55
import { GenericLoader } from "../../generic-loader/GenericLoader.jsx";
66
import { ErrorBoundary } from "../../widgets/error-boundary/ErrorBoundary.jsx";
7+
import "./LazyOutlet.css";
78

89
// A failed dynamic import — almost always a stale hashed chunk after a
910
// redeploy (the client's index.html references a filename the CDN no longer
@@ -74,7 +75,15 @@ export function LazyOutlet() {
7475
onError={handleRouteError}
7576
fallbackComponent={<RouteLoadError />}
7677
>
77-
<Suspense fallback={<GenericLoader />}>
78+
{/* Wrap the loader so it fills the content area and stays centered — see
79+
LazyOutlet.css for why GenericLoader needs this here. */}
80+
<Suspense
81+
fallback={
82+
<div className="lazyOutletFallback">
83+
<GenericLoader />
84+
</div>
85+
}
86+
>
7887
<Outlet />
7988
</Suspense>
8089
</ErrorBoundary>

0 commit comments

Comments
 (0)