Skip to content

fix(signals): a projection's synchronous throw reaches its readers (#3956) - #3979

Merged
ryansolid merged 1 commit into
nextfrom
fix/projection-sync-throw-3956
Oct 11, 2026
Merged

ryansolid merged 1 commit into
nextfrom
fix/projection-sync-throw-3956

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #3956

What was wrong: when a createProjection re-ran and threw synchronously (e.g. the entry it reads has since failed), the error stayed on the projection's internal derive. Readers of the projection's fields subscribe to the leaves, not to the derive, so nothing woke them: the screen kept showing the last good value and no <Errored> caught anything. The catch only woke the leaves' readers for NotReadyError (a flight going up).

Fix: in the pass's catch, any other error wakes the family's readers too (errorFamily), so they re-derive and meet the error. One line in store/projection.ts.

Test: tests/store/projection-sync-throw-3956.test.ts. A projection reads entry(key()) and throws when the entry is errored, under Errored(Loading(...)). setKey("bad") now shows ERRORED; on next it stayed row-good.

Size: +6 B minified on "hydrating + every store primitive family"; the core, isPending/latest, render and CSR scenarios are unchanged. Full signals suite: 5156 passed, 22 expected fail.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ


Generated by Claude Code

…3956)

A re-run of a projection that threw synchronously only woke the leaves'
readers for NotReadyError; any other error stayed with the derive, which
the leaves' readers do not subscribe to, so the screen kept the last good
value. Wake them the same way so they re-derive and meet the error.

Fixes #3956

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ
@changeset-bot

changeset-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b711c3

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

This PR includes changesets to release 12 packages
Name Type
@solidjs/signals Patch
test-integration Patch
@solidjs/web Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
solid-js Patch
@solidjs/universal Patch
todos-server-example 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

@github-actions

Copy link
Copy Markdown

Size (brotli, eager entry chunk)

scenario head vs base minified vs base minified vs recorded cap lazy chunks (not counted)
signals: core floor (createSignal/Memo/Effect/Root/flush) 7.44 KB 0 B 0 B +32 B 7.45 KB ✅
signals: + createStore 14.70 KB +5 B (+0.0%) +6 B +10 B 14.71 KB ✅
signals: + isPending/latest 9.71 KB 0 B 0 B −42 B 9.73 KB ✅
app: render + one signal (the simple-app floor) 9.92 KB 0 B 0 B −38 B 9.94 KB ✅
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 17.69 KB 0 B 0 B −649 B 17.93 KB ✅ lazy-page.js 0.04 KB
app: hydrating + every store primitive family 29.07 KB −49 B (−0.2%) +6 B −518 B 29.27 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 12.95 KB 0 B 0 B −46 B 12.98 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 14.55 KB 0 B 0 B −30 B 14.56 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 28.84 KB 0 B 0 B +26 B 28.89 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 10.12 KB 0 B 0 B −56 B 10.13 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 25.42 KB −21 B (−0.1%) +8 B −33 B 25.46 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 31.13 KB −7 B (−0.0%) +6 B −655 B 31.39 KB ✅ stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.43 KB 0 B 0 B 0 B 11.43 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.85 KB 0 B 0 B −2310 B 34.33 KB ✅ assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, trace.js 8.78 KB, wire.js 0.93 KB
page: live server components (base + live/GET + action + isPending/latest) 37.62 KB 0 B 0 B −2382 B 38.15 KB ✅ assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, trace.js 8.77 KB, wire.js 0.93 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 34.75 KB 0 B 0 B −3475 B 35.66 KB ✅ assets.js 0.78 KB, bind.js 1.82 KB, decode.js 6.23 KB, regions.js 0.80 KB, sc-comments.js 0.20 KB, trace.js 8.74 KB, wire.js 0.93 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 40.29 KB 0 B 0 B −3488 B 41.21 KB ✅ eager (counted): web.js 21.23 KB; assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, regions.js 0.79 KB, sc-comments.js 0.19 KB, trace.js 8.73 KB, wire.js 0.93 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.25 KB 0 B 0 B −2316 B 41.79 KB ✅ assets.js 0.78 KB, bind.js 1.84 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, server.js 1.02 KB, serverForms.js 3.59 KB, trace.js 8.79 KB, wire.js 0.94 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 47.02 KB 0 B 0 B −2327 B 47.49 KB ✅ eager (counted): client.js 27.48 KB; assets.js 0.78 KB, bind.js 1.85 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.81 KB, server.js 1.02 KB, serverForms.js 3.30 KB, trace.js 8.75 KB, wire.js 0.94 KB
server: floor (getRequestEvent + isServer) 1.33 KB 0 B 0 B 0 B 1.34 KB ✅
server: renderToString (the server-render floor) 20.40 KB 0 B 0 B +4 B 20.42 KB ✅

Bundled with Rolldown (what Vite ships), brotli q11, decimal KB. A scenario fails only when it is over its brotli cap and its minified size is more than 20 B over the minified recorded with the cap; over the cap within that allowance is brotli layout noise and passes with a warning. Caps and their recorded minified in scripts/size/scenarios.js; the floor and page caps in floor-caps.json are frozen (lower only, or Size-Exception: in the PR body). npm run ratchet lowers caps per RC; it never raises one (scripts/size/README.md).

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 38124404564

Coverage remained the same at 77.429%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1321
Covered Lines: 1079
Line Coverage: 81.68%
Relevant Branches: 1036
Covered Branches: 746
Branch Coverage: 72.01%
Branches in Coverage %: Yes
Coverage Strength: 27.15 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Member Author

Review at 4b711c35, compared against next (c51c5c95). Good to merge; no findings.

Checked by running the sync-throw shape beside its rejected-promise twin (which already worked on next). With this PR the two agree everywhere I tried:

shape next, sync throw this PR, sync throw rejected-promise twin
good → bad, plain reader stays row-good ERRORED ERRORED
reader that also calls isPending stays row-good ERRORED ERRORED
two Errored boundaries over the same projection both stay both ERRORED both ERRORED
reader through a memo stays ERRORED ERRORED
key change held by an open action stays after release row-good while held, ERRORED at release same
createStore(fn) instead of createProjection stays ERRORED ERRORED
  • No extra runs. The projection runs the same number of times as the twin for the change (+2) and not at all while idle afterwards, so waking the family on a sync throw doesn't start a retry loop, including with the isPending reader that [2.0 rc.14 / next] Errored derived store re-fetches in an endless loop when a row binding also reads isPending() #3945 was about.
  • Recovery matches the twin. setKey("good"), a new key, and reset() after the entry is fixed all leave the fallback.
  • Starting on the failing key already reached ERRORED on next and still does.
  • Signals suite passes locally (5156 passed, 22 expected fail); required checks are green.

One thing for the issue, not this PR: #3956 also reports a "Potential Infinite Loop Detected" with a mutation's isPending and a refetched list on one spread. It has no repro and nothing here touches it, so it will be lost when #3956 is closed unless it gets its own issue.

— Claude via Claude Code


Generated by Claude Code

@codspeed

codspeed Bot commented Oct 11, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 12.68%

⚠️ 2 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 194 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ createStore setter: delete + set one root key (#3044 overlay) 2.1 ms 1.8 ms +12.68%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/projection-sync-throw-3956 (4b711c3) with next (c51c5c9)

Open in CodSpeed

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.

3 participants