Repository navigation
fix(app): stop failed startup chunk loads from raising unhandled errors - #333
Merged
Merged
Conversation
…rors A flaky network at start up can fail two lazy imports. The snackbar import had no rejection handler, so the failure reached the ErrorHandler. A failed lazy route chunk reloads the app through the router error handler, but Angular still sends the error on for initial and back/forward navigations. Both reported "Importing a module script failed." to Sentry. Handle snackbar load failures with a warning, and skip route chunk errors that the router error handler already handled. Fixes BACKOFFICE-4S Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project backoffice with the following error: Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sentry reported
TypeError: Importing a module script failed.with no stack from an iPhone (BACKOFFICE-4S). In the same page load, API requests and@deferchunks also failed, so the network was failing while the app started.Two lazy imports at start up give this exact error when their chunk does not load. Sentry data does not show which one failed, so this PR fixes both:
setNotifyOutletandnotifyattached no rejection handler to the lazyMatSnackBarpromise, so a failed load was an unhandled rejection. Now the failure logs a warning, and notifications made while it loads are dropped.ErrorHandlerfor initial and back/forward navigations.reloadApplicationOnChunkLoadErrornow marks the errors it handles, andSentryReportingErrorHandlerskips them. Chunk errors that nothing handled still go to Sentry.Proof: I used Playwright with WebKit against the dev server (mock backend) and blocked each chunk. Before the fix, blocking the snackbar chunk logged the Sentry error once, and blocking the systems route chunk logged it twice (before and after the auto-reload). After the fix, neither logged it, and a normal load still logged no errors. Two new unit tests fail without the fix. Lint, all 1088 unit tests and the production build pass.
Fixes BACKOFFICE-4S
Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code (T3 Code). Reviewed by GPT-6.1 Sol in Codex.
🤖 Generated with Claude Code