Skip to content

fix(signals): defer mid-flush unhandled async warning until settle (#5203) - #5270

Open
MilindChatrabhuji wants to merge 1 commit into
solidjs:mainfrom
MilindChatrabhuji:fix/loading-on-mount-effect-5203
Open

MilindChatrabhuji wants to merge 1 commit into
solidjs:mainfrom
MilindChatrabhuji:fix/loading-on-mount-effect-5203

Conversation

@MilindChatrabhuji

Copy link
Copy Markdown

Fixes #5203

Cause

During a mount flush (globalQueue._running while enforceLoadingBoundary(true) is active), an EFFECT_USER callback can write a signal that is read directly by content inside <Loading on={memo()}> at a lower heap height than on's memo. Because GlobalQueue.notify ran catchHook before the higher-height on computation had run arm(b) in that same heap pass, notifyEffectStatus emitted ASYNC_OUTSIDE_LOADING_BOUNDARY immediately even though the boundary re-armed and hid the pending read before settle() completed.

Fix

  • Extract reportOutsideLoadingBoundary in packages/signals/src/core/scheduler.ts (packages/signals/src/core/effect.ts calls it directly when !globalQueue._running, preserving synchronous mount checks).
  • When GlobalQueue.notify runs mid-flush (this._running with __DEV__ && _enforceLoadingBoundary && !_reportedUnhandledAsync), queue the node in _unhandledAsync and evaluate after settle() in globalQueue.flush() — emitting ASYNC_OUTSIDE_LOADING_BOUNDARY only if an effect remains pending, non-disposed, and not behind a boundary fallback (!hiddenHook?.(n)).
  • Guarded behind __DEV__, adding 0 bytes to production and observe bundles.
  • Added regression tests in packages/signals/tests/loading-on-mount-effect-5203.test.ts and packages/solid/test/loading-on-mount-effect-5203.spec.ts.

Verification

Run after final edits on Windows:

  • @solidjs/signals vitest: 574/577 files (7313 passed, 17 xfail, 2 skipped); loading-on-mount-effect-5203.test.ts (5/5), latest-stale-branch-hold-4661.test.ts (9/9), and enforceLoadingBoundary.test.ts (4/4) pass. Pre-existing Windows-only failures: dist-artifacts.test.ts (ENAMETOOLONG on 5 cases), rules-index.test.ts (path separators), treeshake.test.ts (4 cases).
  • solid-js vitest: 59/60 files (941/944 passed); loading-on-mount-effect-5203.spec.ts (2/2), cross-package-fields.spec.ts (3/3), diagnostics-catalog.spec.ts (3/3), and public-boundary-exports.spec.ts (2/2) pass. Pre-existing Windows failure: published-declarations.spec.ts (3 cases).
  • node scripts/check-release-invariants.mjs: passed.
  • scripts/size gate.mjs: all 15 non-compiler scenarios pass (app: hydrating WARN -105 B vs recorded capMinified; page: base 34.23 KB, page: live 41.68 KB, core floor 7.54 KB); the 7 compiled scenarios were not run locally because @solidjs/compiler-wasm32-wasi is not built in this workspace.

@changeset-bot

changeset-bot Bot commented Nov 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 64668b8

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

This PR includes changesets to release 5 packages
Name Type
@solidjs/signals Patch
@solidjs/web Patch
@solidjs/diagnostics Patch
solid-js Patch
@solidjs/universal 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

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.

[2.0.4] <Loading on>: a read started by an effect's write in the mount flush is forwarded to the root instead of being caught

1 participant