Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Add per-route error boundary to keep app shell alive on page crash

rcourtman3ea61e117d15
diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx
index 7538212bda..b13a9a8572 100644
--- a/frontend-modern/src/App.tsx
+++ b/frontend-modern/src/App.tsx
@@ -2,7 +2,7 @@ import { Show, lazy, createSignal, createEffect, createMemo, onCleanup, onMount
import type { JSX } from 'solid-js';
import { Router, Route, useNavigate, useLocation } from '@solidjs/router';
import { ToastContainer } from './components/Toast/Toast';
-import { ErrorBoundary } from './components/ErrorBoundary';
+import { ErrorBoundary, RouteErrorBoundary } from './components/ErrorBoundary';
import { SecurityWarning } from './components/SecurityWarning';
import { Login } from './components/Login';
import { logger } from './utils/logger';
@@ -483,7 +483,9 @@ function App() {
showOrgSwitcher={runtime.showOrgSwitcher}
onSwitchOrg={runtime.handleOrgSwitch}
>
- {props.children}
+ <RouteErrorBoundary>
+ {props.children}
+ </RouteErrorBoundary>
</AppLayout>
</div>
{/* AI Panel - slides in from right, pushes content.
diff --git a/frontend-modern/src/components/ErrorBoundary.tsx b/frontend-modern/src/components/ErrorBoundary.tsx
index d3d88c8785..739d4b8b36 100644
--- a/frontend-modern/src/components/ErrorBoundary.tsx
+++ b/frontend-modern/src/components/ErrorBoundary.tsx
@@ -84,6 +84,43 @@ export const ErrorBoundary: Component<ErrorBoundaryProps> = (props) => {
);
};
+// Route-level error boundary — keeps the app shell (sidebar, header, nav) intact
+// when a page component crashes. Renders inline within the content area.
+export const RouteErrorBoundary: Component<{ children: JSX.Element }> = (props) => {
+ return (
+ <ErrorBoundary
+ fallback={(_error, reset) => (
+ <div class="flex min-h-[60vh] items-center justify-center p-4">
+ <div class="max-w-md w-full bg-surface rounded-md shadow-sm p-6">
+ <div class="flex items-center mb-4">
+ <AlertTriangleIcon class="mr-3 h-10 w-10 text-red-500" aria-hidden="true" />
+ <SectionHeader
+ title="This page couldn't load"
+ description="An unexpected error occurred"
+ size="md"
+ titleClass="text-base-content"
+ descriptionClass="text-sm text-muted"
+ />
+ </div>
+ <CalloutCard
+ tone="danger"
+ scale="compact"
+ padding="sm"
+ class="mb-4"
+ description="Try again, or navigate to another page using the sidebar."
+ />
+ <Button onClick={reset} variant="primary" size="md" class="w-full">
+ Try Again
+ </Button>
+ </div>
+ </div>
+ )}
+ >
+ {props.children}
+ </ErrorBoundary>
+ );
+};
+
// Component-specific error boundary with more context
export const ComponentErrorBoundary: Component<{
name: string;