Skip to content

fix(app): stop failed startup chunk loads from raising unhandled errors - #333

Merged
MrYuion merged 1 commit into
developfrom
t3/fix-backoffice-4s
Oct 29, 2026
Merged

MrYuion merged 1 commit into
developfrom
t3/fix-backoffice-4s

Conversation

@MrYuion

@MrYuion MrYuion commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Sentry reported TypeError: Importing a module script failed. with no stack from an iPhone (BACKOFFICE-4S). In the same page load, API requests and @defer chunks 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:

  • Snackbar: setNotifyOutlet and notify attached no rejection handler to the lazy MatSnackBar promise, so a failed load was an unhandled rejection. Now the failure logs a warning, and notifications made while it loads are dropped.
  • Lazy route chunk: our router error handler already reloads the app once when a route chunk fails. But Angular still sends the error to the ErrorHandler for initial and back/forward navigations. reloadApplicationOnChunkLoadError now marks the errors it handles, and SentryReportingErrorHandler skips 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

…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>
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

Deployment failed for project backoffice with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit

@MrYuion
MrYuion merged commit 70da8d3 into develop Oct 29, 2026
5 of 6 checks passed
@MrYuion
MrYuion deleted the t3/fix-backoffice-4s branch October 29, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant