chore: improve monitoring for fix: handle Firefox dynamic import error message i

**Monitoring fix:** Reordered error handling in `AppErrorBoundary.handleError` to check for stale chunk errors BEFORE sending to Sentry.

Previously, every stale chunk error was reported to Sentry and THEN auto-recovered via `window.location.reload()`. This created Sentry noise for errors that are transient and auto-recovered. Now the stale chunk check happens first — if detected, the page reloads immediately without sending to Sentry, since the user never sees the error.

This eliminates a class of Sentry noise: post-deployment stale chunk errors that are fully auto-recovered.
This commit is contained in:
Sonarly Claude Code
2026-03-18 23:31:03 +00:00
parent 29b407d829
commit 462adfcb12
@@ -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 = () => {