From 87e2e82136785d4dc25c9052cb122ee4812f8034 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Tue, 26 May 2026 14:01:56 +0300 Subject: [PATCH] fix(routing): give every lazy page its own ErrorBoundary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A render error in any route used to bubble all the way up to the single page-level boundary at AppWithNavigator, replacing the entire shell (sidebar, header, blocking overlays) with the contained error UI — even if only one sub-page was broken. Embed an ErrorBoundary inside LazyPage so the smallest meaningful unit (a route's lazy chunk + its rendered tree) is the boundary scope. Shell chrome stays alive, the user can navigate elsewhere, and chunk-load failures still get the lazyWithRetry reload path because the boundary sits outside Suspense. --- src/App.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 6fbd3ba..5ad2288 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -200,9 +200,16 @@ function AdminRoute({ children }: { children: React.ReactNode }) { return {children}; } -// Suspense wrapper for lazy components +// Suspense + error boundary wrapper for lazy routes. The boundary lives +// OUTSIDE Suspense so chunk-load failures (caught by lazyWithRetry's reload +// path) and render-time exceptions both surface in the page-level fallback +// instead of crashing the entire shell via the top-level boundary. function LazyPage({ children }: { children: React.ReactNode }) { - return }>{children}; + return ( + + }>{children} + + ); } function BlockingOverlay() {