Repository navigation
fix(signals): defer mid-flush unhandled async warning until settle (#5203) - #5270
Open
MilindChatrabhuji wants to merge 1 commit into
Open
MilindChatrabhuji wants to merge 1 commit into
MilindChatrabhuji wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 64668b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
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.
Fixes #5203
Cause
During a mount flush (
globalQueue._runningwhileenforceLoadingBoundary(true)is active), anEFFECT_USERcallback can write a signal that is read directly by content inside<Loading on={memo()}>at a lower heap height thanon's memo. BecauseGlobalQueue.notifyrancatchHookbefore the higher-heightoncomputation had runarm(b)in that same heap pass,notifyEffectStatusemittedASYNC_OUTSIDE_LOADING_BOUNDARYimmediately even though the boundary re-armed and hid the pending read beforesettle()completed.Fix
reportOutsideLoadingBoundaryinpackages/signals/src/core/scheduler.ts(packages/signals/src/core/effect.tscalls it directly when!globalQueue._running, preserving synchronous mount checks).GlobalQueue.notifyruns mid-flush (this._runningwith__DEV__ && _enforceLoadingBoundary && !_reportedUnhandledAsync), queue the node in_unhandledAsyncand evaluate aftersettle()inglobalQueue.flush()— emittingASYNC_OUTSIDE_LOADING_BOUNDARYonly if an effect remains pending, non-disposed, and not behind a boundary fallback (!hiddenHook?.(n)).__DEV__, adding 0 bytes to production and observe bundles.packages/signals/tests/loading-on-mount-effect-5203.test.tsandpackages/solid/test/loading-on-mount-effect-5203.spec.ts.Verification
Run after final edits on Windows:
@solidjs/signalsvitest:574/577files (7313passed,17xfail,2skipped);loading-on-mount-effect-5203.test.ts(5/5),latest-stale-branch-hold-4661.test.ts(9/9), andenforceLoadingBoundary.test.ts(4/4) pass. Pre-existing Windows-only failures:dist-artifacts.test.ts(ENAMETOOLONGon 5 cases),rules-index.test.ts(path separators),treeshake.test.ts(4 cases).solid-jsvitest:59/60files (941/944passed);loading-on-mount-effect-5203.spec.ts(2/2),cross-package-fields.spec.ts(3/3),diagnostics-catalog.spec.ts(3/3), andpublic-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/sizegate.mjs: all15non-compiler scenarios pass (app: hydratingWARN-105 Bvs recordedcapMinified;page: base34.23 KB,page: live41.68 KB,core floor7.54 KB); the7compiled scenarios were not run locally because@solidjs/compiler-wasm32-wasiis not built in this workspace.