fix(ui): avoid scrollbar flashes when lazy dialogs load (#6981)

While a lazily loaded dialog's code downloaded, LazyMount's default Spin fallback was laid out beside the page content, narrowing it and poking past the right edge, so scrollbars flashed. The default fallback is now a fullscreen Spin outside the layout; a story pins the content width while the dialog loads.
This commit is contained in:
VAIO73
2026-11-02 15:50:20 +01:00
committed by GitHub
parent 54a509fd67
commit 1796352600
2 changed files with 61 additions and 3 deletions
@@ -11,7 +11,11 @@ interface LazyMountProps {
// thereafter, so React.lazy modals get loaded on demand but their close
// animations still play out. Pair with `lazy(() => import(...))` modal imports
// on heavy list pages to keep the initial bundle small.
export default function LazyMount({ when, fallback = <Spin />, children }: LazyMountProps) {
export default function LazyMount({
when,
fallback = <Spin fullscreen />,
children,
}: LazyMountProps) {
const [mounted, setMounted] = useState(when);
if (when && !mounted) setMounted(true);
if (!mounted) return null;