You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle stale chunk errors by reloading page after deployments (#8421)
* Handle stale chunk errors by reloading the page after deployments
When assets are redeployed with new content hashes, users with cached
pages get TypeError when dynamically imported chunks (React.lazy) no
longer exist on the CDN. This adds graceful recovery by detecting these
errors and triggering a page reload with loop prevention.
- Create chunk-load-error-handler utility with browser-variant detection
(Chrome, Firefox, Safari all use different error messages)
- Add ErrorBoundary fallback in react-bootloader to catch chunk errors
in the React tree and reload instead of showing blank components
- Add global unhandledrejection handler as safety net for failures
outside the React error boundary tree
- Fix Sentry beforeSend filter to match all browser error variants
(was only matching Chrome's "Failed to fetch dynamically imported module")
- Guard ErrorFallback auto-reset against chunk errors to prevent
infinite retry loops
Closes#8369
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add retry logic for dynamic imports to handle transient failures
Old chunk files persist on the CDN, so import failures are transient
(network blips, CDN hiccups) rather than missing files. Instead of
immediately reloading the page, retry the import up to 3 times with
a 1-second delay between attempts.
- Create lazy-with-retry utility as drop-in replacement for React.lazy
- Update all 6 files that use lazy() to import from the retry utility
(129 lazy call sites, only import lines change)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Handle chunk load errors at source to prevent Sentry propagation
After all retries are exhausted, if the error is a chunk load error,
reload the page directly instead of throwing. This ensures the error
never reaches Sentry.captureException via ErrorBoundary handlers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments