Skip to content

fix(solid): Show's narrowed accessor reads the screen during a closing hold (#4354) - #4359

Merged
ryansolid merged 1 commit into
nextfrom
claude/project-thread-x1ore2-4354
Oct 28, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/project-thread-x1ore2-4354

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #4354

Summary

Non-keyed <Show> decided whether the narrowed accessor was stale from a shown flag (#3948). The selection memo set that flag every time it ran. Say a hold keeps a closing branch on screen: setOpen(false) is held by a <Loading> sibling's re-ask. The selection has already re-run in the held world and set shown = false. If an unrelated write (setFmt) then re-runs one of the on-screen branch's bindings, its v() read throws "Attempting to access a stale value from …". Under render() that shows up as REACTIVITY_HALTED and the screen freezes. <Switch>/<Match> with the same shape does not throw.

The fix makes Show's guard work like Match's: it reads condition() tracked (if (!condition()) throw …) and drops the shown flag.

The binding now also tracks condition, the truthiness memo, which already exists. There are no new computations, effects or exports. condition only changes when truthiness flips, and when that happens the branch is torn down anyway. The keyed mode has no accessor and no guard, so it is unchanged.

How did you test this change?

New tests, each of which fails on next in the non-keyed Show case and passes with this change:

  • packages/solid/test/show-shown-flag-halt-4354.spec.ts covers four modes: Show, Show keyed, Switch/Match and Match keyed.
    • For each mode it checks that a branch re-run during a hold that closes it does not halt. After the close lands, a read of the accessor still throws <Show> / <Match>.
    • For each mode it checks that a fallback re-run during a hold that opens the branch does not halt.
    • It also checks a Show branch that is closed and reopened inside one hold: it keeps reading the screen (ru:a, en:a, fr:a) and lands on fr:b.
  • packages/web/test/show-held-close-binding-4354.spec.tsx runs the same shape as JSX under render(), keyed and non-keyed, with ${fmt()}:${v()} in one text binding.

The existing #3948 tests (show-latest-3948 in solid and web) still pass.

Suites (run after a clean turbo build):

  • signals: 5653 passed.
  • solid: 906 passed.
  • web, client config: passes except uncommitted-input-overwritten, which also fails on next locally.
  • web, server config: passes except server-functions-adapter-request "keeps a rebuild failure's own error…" and lone-spread-hydration-key-4240. Both also fail on next locally, and the server bundle doesn't contain this change.
  • web, hydrate config: a fully green run, plus one run with only the known c03-hydration-done-counts-holds flake.
  • Types: test-types passes in solid and web.

Size (scripts/size, head vs base in the same environment): every scenario that bundles Show is −7 B minified. Brotli changes by −69 to +30 B, which is layout noise. Scenarios without Show are unchanged, including the hello-world floors. gate.mjs passes, and no caps or frozen floors move.


Generated by Claude Code

…g hold (#4354)

Non-keyed Show judged staleness from a `shown` flag the selection memo set
on every run. When a hold kept the branch on screen, the selection had
already re-run in the held world and set the flag false, so an unrelated
write that re-ran an on-screen binding threw the stale-value error and
halted. The guard now reads `condition()` tracked, as Match's guard does:
the reading binding is a frame reader and sees the screen's truthiness,
while a read after unmount still sees the committed falsy and throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2982c08

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

This PR includes changesets to release 15 packages
Name Type
solid-js Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
test-integration Patch
@solidjs/universal Patch
@solidjs/web Patch
board-example Patch
canvas-example Patch
server-dbmon-example Patch
todos-server-example Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/signals 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.42 KB 0 B 0 B −119 B 7.44 KB ✅
signals: + createStore 14.92 KB 0 B 0 B −1359 B 15.04 KB ✅
signals: + isPending/latest 10.37 KB 0 B 0 B −13 B 10.38 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.05 KB 0 B 0 B −123 B 8.05 KB ✅
app: render + one signal (the simple-app floor) 9.78 KB 0 B 0 B −179 B 9.75 KB ⚠️ over by 26 B, 199 B minified headroom
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.57 KB −32 B (−0.2%) −7 B −251 B 18.49 KB ⚠️ over by 84 B, 271 B minified headroom lazy-page.js 0.04 KB
app: hydrating + every store primitive family 31.18 KB +5 B (+0.0%) −7 B −7 B 31.19 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.36 KB −20 B (−0.1%) −7 B −257 B 13.40 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.11 KB −1 B (−0.0%) −7 B −263 B 15.14 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 29.66 KB −28 B (−0.1%) −7 B −261 B 29.70 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.97 KB 0 B 0 B −178 B 9.93 KB ⚠️ over by 38 B, 198 B minified headroom
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.18 KB +30 B (+0.1%) −7 B −580 B 26.27 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.30 KB −41 B (−0.1%) −7 B −511 B 32.25 KB ⚠️ over by 50 B, 531 B minified headroom stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.75 KB 0 B 0 B 0 B 11.76 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.52 KB −69 B (−0.2%) −7 B −189 B 33.37 KB ⚠️ over by 153 B, 209 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.01 KB, wire.js 3.47 KB
page: live server components (base + live/GET + action + isPending/latest) 37.92 KB −22 B (−0.1%) −7 B −1 B 37.75 KB ⚠️ over by 172 B, 21 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 8.98 KB, wire.js 3.47 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 35.50 KB +5 B (+0.0%) −7 B −177 B 35.43 KB ⚠️ over by 74 B, 197 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.06 KB, sc-comments.js 0.20 KB, trace.js 8.95 KB, wire.js 3.47 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 41.77 KB −40 B (−0.1%) −7 B −2 B 41.56 KB ⚠️ over by 206 B, 22 B minified headroom eager (counted): web.js 22.33 KB; assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.07 KB, sc-comments.js 0.19 KB, trace.js 9.03 KB, wire.js 3.47 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 40.98 KB −6 B (−0.0%) −7 B −188 B 40.81 KB ⚠️ over by 173 B, 208 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, server.js 1.03 KB, serverForms.js 3.59 KB, trace.js 8.98 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 47.38 KB −17 B (−0.0%) −7 B −22 B 47.16 KB ⚠️ over by 222 B, 42 B minified headroom eager (counted): client.js 27.47 KB; assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.08 KB, server.js 1.03 KB, serverForms.js 3.30 KB, trace.js 8.99 KB, wire.js 3.49 KB
server: floor (getRequestEvent + isServer) 1.27 KB 0 B 0 B −69 B 1.34 KB ✅
server: renderToString (the server-render floor) 22.79 KB 0 B 0 B 0 B 22.80 KB ✅

⚠️ Over the brotli cap within the minified allowance (passes)

  • app: render + one signal (the simple-app floor): over brotli cap by 26 B; minified 26,850 B vs 27,029 B recorded with the cap (−179 B) — 199 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: hydrating (no stores) with Show/For/Loading/Errored/lazy: over brotli cap by 84 B; minified 53,369 B vs 53,620 B recorded with the cap (−251 B) — 271 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • app: compiled floor (one template, one text hole, one delegated click): over brotli cap by 38 B; minified 27,382 B vs 27,560 B recorded with the cap (−178 B) — 198 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable): over brotli cap by 50 B; minified 100,533 B vs 101,044 B recorded with the cap (−511 B) — 531 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: base server components (hydrating + dynamic + frames + sf reference): over brotli cap by 153 B; minified 101,370 B vs 101,559 B recorded with the cap (−189 B) — 209 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: live server components (base + live/GET + action + isPending/latest): over brotli cap by 172 B; minified 115,216 B vs 115,217 B recorded with the cap (−1 B) — 21 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread): over brotli cap by 74 B; minified 107,741 B vs 107,918 B recorded with the cap (−177 B) — 197 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: compiled live server components (the compiled base page + live/GET + action + isPending/latest): over brotli cap by 206 B; minified 123,214 B vs 123,216 B recorded with the cap (−2 B) — 22 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate): over brotli cap by 173 B; minified 125,199 B vs 125,387 B recorded with the cap (−188 B) — 208 B of the 20 B minified allowance left; −7 B minified over this PR's base
  • page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate): over brotli cap by 222 B; minified 140,458 B vs 140,480 B recorded with the cap (−22 B) — 42 B of the 20 B minified allowance left; −7 B minified over this PR's base

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 40676203596

Coverage decreased (-0.02%) to 78.709%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1355
Covered Lines: 1125
Line Coverage: 83.03%
Relevant Branches: 1078
Covered Branches: 790
Branch Coverage: 73.28%
Branches in Coverage %: Yes
Coverage Strength: 28.78 hits per line

💛 - Coveralls

@codspeed

codspeed Bot commented Oct 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 196 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing claude/project-thread-x1ore2-4354 (2982c08) with next (38e0c49)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ryansolid
ryansolid merged commit 1f558e5 into next Oct 28, 2026
9 checks passed
ryansolid pushed a commit that referenced this pull request Oct 28, 2026
Brings in #4347, #4350-#4353, #4356, #4357, #4359 and #4360. The one
conflict was in the store-app entry of scripts/size/scenarios.js. Both
ledgers are kept: next's two lines, then this branch's two. The cap is
re-measured after the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
ryansolid added a commit that referenced this pull request Nov 3, 2026
… on a just-mounted branch (Show: #4359 regression) (#4648) (#4657)

* fix(solid): a narrowed Show/Match accessor is live inside isPending() on a just-mounted branch (#4648)

Since #4359 the non-keyed Show guard reads `condition()` tracked. Inside an
`isPending()` thunk that read goes through the verdict path, which answers
with the committed value of a condition staged this flush, so a branch that
mounted in the flush its async condition landed in read as stale: the guard
threw, `isPending` swallowed it, and nothing the thunk read after the
accessor linked, so the verdict never flipped. Match's guard had the same
shape.

Show and Switch now remember the accessor their selection's own run handed
out; that accessor is live whatever the frame. Any other accessor (a branch
a held re-run has already closed, a read after unmount) falls back to the
tracked condition read, so #4354 and #3948 keep their behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE

* perf(solid): scope the #4648 live-accessor mark to the selection run

Show and Switch keep one closure token per selection run instead of resetting
and re-setting the accessor they last handed out, and keep the original
ternary shape. Switch reuses its fresh selection tuple as the token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE

* fix(solid): limit the #4648 live-accessor skip to verdict windows

The run token let the latest run's narrowed Show/Match accessor skip the
stale guard in every frame, so a plain read while the branch's opening
was held (a shown Loading re-asking on the condition) handed out the
committed falsy instead of throwing, as it did on next. The skip now
holds only while a latest()/isPending() window is open, read from the
core's existing `verdict` dispatch slot (re-exported @internal; no
change in verdict.ts).

The token stays a fresh object rather than the condition value: an
earlier run's closure can hold an equal value (true -> false -> true),
and with that token its accessor would skip the guard inside a probe
during a held reopen. Both cases are pinned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE

* perf(solid): narrowedError throws; Show/Match guards as short-circuits (#4648 review trim)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE

---------

Co-authored-by: Claude <[email protected]>
@ryansolid
ryansolid deleted the claude/project-thread-x1ore2-4354 branch November 5, 2026 17:34
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