Repository navigation
fix(signals): settle deferred flights after protocol throws - #4248
Conversation
🦋 Changeset detectedLatest commit: 58d3d52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 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 |
Merging this PR will improve performance by 10.2%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Summary
After
createDeferredhas answered, a synchronous throw from an iterator's firstnext()leaves its flight pending:isPendingstays true anduntil/refreshnever receive the error. A throwing iterator factory can similarly leave the current error waiting for an obsolete request to settle.Extend the existing computation
try/catchthrough result processing, including iterator setup and the initial pull. Preserve its error policy: an unready reactive source parks the flight on itsNotReadyError; other errors retire the flight and are rethrown unchanged. This adds no wrapper, allocation, or extra catch block. Includes 26 regression/control cases and a patch changeset.This follows up #4231's fix for computation-body throws. Related #4112 / #4158 fixed protocol exceptions escaping ordinary memo error handling; this addresses
createDeferred's additional flight bookkeeping.Minimal JSX playground, pinned to 2.0.0-rc.18. Click Run once. Expected:
Pending: false, followed by thestream failederror. Actual:Pending: true, and the error never reaches the awaiting caller. Changing onlynext()toasync next()is a passing control. The saved share was reopened and both cases checked. The same component reproduces against unchanged source-builtnext@cc3ee740and passes with the fix in production, development and observe builds.How did you test this change?
cc3ee740, 13 new cases fail and 13 controls pass. All 26 pass with the fix, as do all 100 focused tests, coveringuntil/refresh, loading seeds, obsolete flights and unready-source parking.npm run build:js,npm run types). Full signals suite: 342 files / 5,573 tests pass, with two expected failures and two skips (vitest run --maxWorkers=2).node scripts/check-release-invariants.mjspass.createDeferredimport is 1 minified byte / 15 Brotli bytes smaller. No caps changed.