Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: reset error boundary on pathname change (#9570)

Yunus Mdbb6b333c870
diff --git a/frontend/src/container/AppLayout/index.tsx b/frontend/src/container/AppLayout/index.tsx
index aa2db87612..3d6cfd579b 100644
--- a/frontend/src/container/AppLayout/index.tsx
+++ b/frontend/src/container/AppLayout/index.tsx
@@ -112,6 +112,8 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
setShowPaymentFailedWarning,
] = useState<boolean>(false);
+ const errorBoundaryRef = useRef<Sentry.ErrorBoundary>(null);
+
const [showSlowApiWarning, setShowSlowApiWarning] = useState(false);
const [slowApiWarningShown, setSlowApiWarningShown] = useState(false);
@@ -378,6 +380,13 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
getChangelogByVersionResponse.isSuccess,
]);
+ // reset error boundary on route change
+ useEffect(() => {
+ if (errorBoundaryRef.current) {
+ errorBoundaryRef.current.resetErrorBoundary();
+ }
+ }, [pathname]);
+
const isToDisplayLayout = isLoggedIn;
const routeKey = useMemo(() => getRouteKey(pathname), [pathname]);
@@ -836,7 +845,10 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
})}
data-overlayscrollbars-initialize
>
- <Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />} key={pathname}>
+ <Sentry.ErrorBoundary
+ fallback={<ErrorBoundaryFallback />}
+ ref={errorBoundaryRef}
+ >
<LayoutContent data-overlayscrollbars-initialize>
<OverlayScrollbar>
<ChildrenContainer>