From 069a003787550d4a9cec5f1bd974e40c90c503ea Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Fri, 7 Mar 2025 21:36:46 +0100 Subject: [PATCH] refactor: do not send sentry errors if offline --- .../common/components/error-boundary/ErrorBoundary.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/client/src/common/components/error-boundary/ErrorBoundary.jsx b/apps/client/src/common/components/error-boundary/ErrorBoundary.jsx index 6eefd207c..f0d3e9477 100644 --- a/apps/client/src/common/components/error-boundary/ErrorBoundary.jsx +++ b/apps/client/src/common/components/error-boundary/ErrorBoundary.jsx @@ -26,17 +26,22 @@ class ErrorBoundary extends React.Component { error, errorInfo: info, }); + this.reportContent = `${error} ${info.componentStack}`; + + const appState = runtimeStore.getState(); + if (appState.ping < 0) { + return; + } Sentry.withScope((scope) => { scope.setExtras({ error, - store: runtimeStore.getState(), + store: appState, hasSocket: { hasConnected, shouldReconnect, reconnectAttempts }, }); const eventId = Sentry.captureException(error); this.setState({ eventId, info }); }); - this.reportContent = `${error} ${info.componentStack}`; } render() {