Skip to content

fix(core): treat failed handler-chunk imports in core dispatch as importError - #9180

Merged
Varixo merged 3 commits into
QwikDev:mainfrom
akasakariko:fix/8962-handler-import-error
Oct 10, 2026
Merged

Varixo merged 3 commits into
QwikDev:mainfrom
akasakariko:fix/8962-handler-import-error

Conversation

@akasakariko

@akasakariko akasakariko commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What is it?

  • Bug

Description

Fixes #8962

Root cause

  • After resume, core dispatches event handlers instead of using the qwikloader import path
  • A failed handler chunk import was routed to the nearest error boundary as an application error, exposing the raw browser message instead of emitting an importError qerror
  • A module-local import error registry also loses the marker when another copy of the Qwik runtime handles the rejection

Changes

  • Report failed handler imports as document qerror events with importError set to async, matching qwikloader and the behavior established in [v2] version-skew handling — failed chunk imports should surface a 'new version available' affordance #8795
  • Continue routing errors thrown or rejected by resolved handlers to the error boundary
  • Share the WeakSet of import errors through the existing registerSingleton helper
  • Keep rejection values unchanged, including frozen errors, rather than attaching a custom field
  • Use isObject and isFunction only before insertion, removing the duplicate guard because WeakSet lookups safely return false for non-object values
  • Add coverage for duplicate core copies, frozen errors, function rejections, primitive rejections, and synchronous or asynchronous handler errors
  • Enable the existing chunk 404 browser regression and retain the core patch changeset

Reproduction

  • Confirmed the original issue using unchanged runtime files from baseline 2f40839 with the handler import regression tests, both variants failed because the boundary rendered the import error
  • Confirmed the duplicate-core regression against PR revision 86e31e7 before changing production code, the second copy failed to recognize the frozen import error
  • Both regressions pass with this update

Verification

Run locally on macOS ARM64 with Node 26 and pnpm 11

  • Core suite, 90 files passed, 2408 tests passed, 18 skipped, 19 todo
  • Focused QRL, singleton, and boundary suites, 258 passed, 1 skipped
  • Chromium error-handling suite, 41 passed, 2 skipped
  • Qwik TypeScript check with no emit passed
  • Development core build passed
  • Full repository ESLint and Prettier checks passed, including insights after building the lint plugin
  • Git whitespace checks passed

Known validation limits

  • The full unit suite has 3971 passing tests and 7 failures in the Vite plugin suite because the optimizer WASM binding is missing
  • Repeating that suite with the unchanged PR runtime at 86e31e7 produces the same 7 failures
  • Firefox and WebKit were not run

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • A core patch changeset is included
  • I added new tests to cover the fix

…ortError (QwikDev#8962)

After resume, handlers run through core (_qDispatch/runEventHandlerQRL), so a
chunk 404 was routed to the nearest <ErrorBoundary> showing the raw fetch
message, while the qwikloader path reports it as an importError qerror that the
client listener skips (QwikDev#8795). Tag errors from failed QRL imports and, in
runEventHandlerQRL, dispatch them as qerror { importError: 'async' } instead of
calling handleError, aligning both channels. Un-fixme the e2e pin.
@akasakariko
akasakariko requested a review from a team as a code owner October 7, 2026 13:19
@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b610695

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/core Patch
@qwik.dev/devtools Patch
eslint-plugin-qwik Patch
@qwik.dev/mcp Patch
@qwik.dev/react Patch
@qwik.dev/router Patch
@qwik.dev/utils Patch
create-qwik Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9180

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9180

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9180

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9180

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9180

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9180

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9180

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9180

commit: b610695

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, thanks for the PR, added small comments

@akasakariko

Copy link
Copy Markdown
Contributor Author

Addressed both review comments in 86e31e7

Validation

  • pnpm exec vitest run packages/qwik/src/core/tests/catch.spec.tsx — 200 passed, 1 skipped
  • pnpm exec vitest run packages/qwik/src — 109 files passed, 2599 tests passed, 18 skipped, 19 todo on two consecutive full reruns
  • pnpm exec eslint 'packages/qwik/src/**/*.ts*' — passed
  • pnpm exec tsc --noEmit -p packages/qwik/tsconfig.json — passed
  • pnpm exec prettier --check packages/qwik/src/core/client/run-qrl.ts packages/qwik/src/core/tests/catch.spec.tsx — passed
  • pnpm build.core — passed
  • git diff --check — passed

The initial full-package run failed the sibling-update assertion in error-handling.spec.tsx with expected 2 and received 1
The isolated file rerun and both subsequent full-package runs passed without changes to that test

GitHub CI for the new commit is pending

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the change, added some more comments

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and changes! LGTM

@Varixo
Varixo merged commit 1ce0dac into QwikDev:main Oct 10, 2026
akasakariko added a commit to akasakariko/akasakariko that referenced this pull request Oct 11, 2026
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.

core: failed handler-chunk import reaches the boundary after resume, bypassing the importError skip

2 participants