diff --git a/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx b/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx index b6f4a893a8b..0ea5976af78 100644 --- a/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx +++ b/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx @@ -22,6 +22,15 @@ export const AppErrorBoundary = ({ resetOnLocationChange = true, }: AppErrorBoundaryProps) => { const handleError = async (error: Error | CustomError, info: ErrorInfo) => { + const isViteStaleChunkLazyLoadingError = + checkIfItsAViteStaleChunkLazyLoadingError(error); + + if (isViteStaleChunkLazyLoadingError) { + window.location.reload(); + + return; + } + try { const { captureException } = await import('@sentry/react'); captureException(error, (scope) => { @@ -36,13 +45,6 @@ export const AppErrorBoundary = ({ // oxlint-disable-next-line no-console console.error('Failed to capture exception with Sentry:', sentryError); } - - const isViteStaleChunkLazyLoadingError = - checkIfItsAViteStaleChunkLazyLoadingError(error); - - if (isViteStaleChunkLazyLoadingError) { - window.location.reload(); - } }; const handleReset = () => {