Skip to content

Commit 09eadfe

Browse files
ryansolidclaudecursoragentClaude via Cursor
authored
fix(signals): a Loading mounted under a hold shows its fallback (L2 regression of #3540) (#3824)
* fix(signals): a fresh Loading over a held value shows its fallback in a flush (#3540, L2 regression) L2 regressed A29's boundary exemption in two ways: - In a flush, a first pass under a loading boundary that has not shown content joined the flush to the hold it read, so the whole tick (the Show that mounted the boundary included) waited for the hold. A first pass that reads a hold now asks the boundaries up its chain (GlobalQueue._fresh); one such boundary catches it, and the pass joins pass-scoped (passTx), as a mount outside a flush does: the boundary's, not the tick's. A derivation outside the boundary in the same flush still holds the tick. A flush that set passTx clears it at its end. - A render effect born held under a fresh loading boundary (content bound in JSX: the tree never reads the held value) was not caught, so the boundary revealed empty content, in a flush and out of one. It is now collected as a reader, and the output's first pass shows the fallback whenever the boundary has collected readers. Refs #3540 Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): the first-pass catch asks only the nearest loading boundary, and only one that has not shown content (#3540) A revealed boundary (re-armed by `on` or not) neither catches nor records a never-committed first pass, and no boundary past the nearest is asked: which boundaries catch what is unchanged beyond A29's boundary exemption. catchStatus is back to next's. Refs #3540 Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): ask the nearest loading boundary through _catch; no new hook (#3540) A pass that read a hold asks GlobalQueue._catch with STATUS_UNINITIALIZED in its flags. Only a first pass is caught, and only by the nearest loading boundary if it has not shown content (`_initialized`, not `_armed`): a revealed boundary, re-armed by `on` or not, neither catches nor records it, and no boundary past the nearest is asked. Pins the revealed-boundary, nested and `on` shapes against next. Refs #3540 Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * chore(size): Size-Exception for #3824 — five caps at CI-measured + 10 B (A29 restore, #3540) app: hydrating + every store primitive family 28.87 -> 28.90 KB, app: compiled CSR 25.13 -> 25.22 KB, app: compiled hydrating 30.93 -> 30.97 KB, page: base server components 44.84 -> 44.90 KB, page: live server components 48.51 -> 48.53 KB. Approved by the maintainer. Refs #3540 Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * chore(size): reset #3824's caps from CI with the recorded minified (#3822 format) Size-Exception (approved): hydrating + stores 28.85 KB, CSR observe 14.48 KB, compiled CSR 25.23 KB, compiled hydrating 30.95 KB, base page 44.86 KB, live page 48.56 KB, each CI brotli (Size run 37450070886) + 10 B with the minified from the same run. Co-authored-by: Cursor <[email protected]> * proto(signals): A29's boundary scope — a boundary that has not shown content owns its subtree (#3540) Prototype for the 2026-10-06 ruling: membership is decided by the boundary scope, not per pass. A read of a held node from under a loading boundary that has not shown content, or that `on` re-armed, joins nothing: the reader is the hold's stale reader (re-derived at its commit) and the read is pending, so the boundary shows its fallback. Exempt when the boundary's own display is the hold's (the flush joined it, the output is held by it, or the mounting pass joined it): the boundary then appears at the commit. Replaces the per-pass attempt (passTx exemption in joinPassTx, the first-pass marker, the creation-branch pending report, the prune uninitialized keep, and the output's A29 exemption). LOADING_ON_OUTSIDE_HOLD reports only a re-arm whose swap is held. Not for #3824 as-is; the maintainer decides from the report. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * proto(signals): an owned held computation re-derives at the read (#3540) Semantic fuzzer (rev 19, seed 91501, branch-boundaries #870): an `on` re-arm left the tree held by an earlier hold; the output read it, the scope made the read pending, and the tree was recorded as a reader that had already settled — the boundary redrew forever. A held computation read from the scope that owns it is content, not a hold: it leaves the transaction (`leaveHold`, shared with `recompute`'s head) and re-derives at the read. Pins the stale-content finding (boundaries #1078) as `it.fails`: membership decided mid-flush is not revisited when the flush later joins the hold. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): A29's boundary scope — ownership decided at the seam, behind boundary hooks (#3540) Lands the 2026-10-06 boundary-scope ruling. A loading boundary that has not shown content, or that `on` re-armed, owns its subtree: a read of a hold from under it is pending there (the boundary shows its fallback, no hold waits for it), and the reader re-derives at the hold's commit. - Hooks: the ownership logic lives in boundaries.ts behind `GlobalQueue._owns(c, el)` (asked at the hold's doors: `read`, a store draft, `recompute`'s head, `propagateStatus`) and the new `GlobalQueue._boundaryPark(t)`; core pays the null checks. - The seam: the reads the scope made pending, and the nodes that left a hold, are revisited once the flush has parked (its membership final). A read whose hold the flush joined after it was the hold's after all and re-derives as its work; a swap parked with another change takes the hold its content read (or left) with it. - A re-arm that finds nothing pending owns what an earlier change holds under it with no flight (an action's staged write): it leaves the hold and re-derives now (mount-under-hold `rearm-committed`). Pins the A15 landing tear a re-arm exposes (`it.fails`; boundaries #75's reduction shows it on next without a boundary). Open, not the scope's: a boundary a verdict reader mounts derives in the verdict lane (the first-pass lane rule, #3835's seam). Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * docs(signals): regenerate RULES-INDEX without local probe files (#3540) Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): rebuild #3540's L2 fix on revision 1; defer re-arm Replaces the boundary-scope machinery (ownership hook, held-node leave, re-arm `ownHeld`, the seam park) with revision 1's fresh-mount fix (0479053) on today's next: a first pass that reads a hold asks the boundaries up its chain (GlobalQueue._fresh); when a loading boundary that has not shown content catches it, the pass joins pass-scoped (passTx) instead of joining the flush, so the mount publishes and the boundary shows its fallback. A render effect born held under the boundary is caught the same way. catchStatus is unchanged. Re-arm under the boundary scope is deferred to a separate change, pending its ruling: those tests are pinned it.fails, the re-arm amendment text is back to next's wording with a dated note, and async.ts, store.ts and flow.ts are back to next. Refs #3540 Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Claude via Cursor <[email protected]>
1 parent 9d89df7 commit 09eadfe

11 files changed

Lines changed: 1719 additions & 79 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
A fresh `Loading` mounted over a held value shows its fallback in a flush too (#3540 under L2): a first pass a loading boundary that has not shown content catches is the boundary's, not the tick's, so the mount publishes and the content reveals at the commit. Content bound by a render effect under the boundary is collected, so the boundary no longer reveals empty content.

‎documentation/solid-2.0/05-async-data.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Importantly, `Loading` is intended to cover **branch readiness**: it handles a s
4747

4848
Nested `Loading` boundaries can be used to avoid blocking large subtrees and to control where loading UI appears.
4949

50+
A `Loading` that has not shown content yet owns what is under it. Content there that reads a value a still-running change holds (a write inside an `action`, data another change is loading) is not part of that change: the boundary shows its fallback now, and the content appears when the change commits. The change does not wait for it. The exception is a boundary mounted by the change itself, for example a `<Show when={x()}>` where `x` is the held write: it appears with that change's commit, with no fallback. While the fallback shows, `isPending()` of the boundary is `false`, as for any first load.
51+
5052
#### `Loading` `on` prop: dependencies that show the fallback again
5153

5254
By default, once a `Loading` boundary has rendered content, it keeps that content visible during revalidation: like every reader of a pending value, it holds the write that made it pending until the data lands. The `on` prop is a **dependency list**: a tracked expression whose value is irrelevant — what matters is what it reads. Whenever anything it reads changes, the boundary stops waiting on its current content: if something under it is pending, it shows its fallback again until the new content is ready; if nothing is pending, nothing happens.
@@ -81,6 +83,8 @@ The shell keeps showing A until `product(2)` lands; the spinner arrives with B,
8183

8284
One shape shows no fallback at all: when the data the boundary is waiting on is also read outside it (a sibling `<Loading>` over the same `comments(id)`, an `isPending` on it in the header), or the write's `action` stays open until the data lands. The frame waits on that read, so by the time it commits the content is ready and the fallback was never needed. The first of these is structural — no ordering of the flights can show that fallback — and in development the `LOADING_ON_OUTSIDE_HOLD` diagnostic names the source; the fix is to move the outside read under the boundary so one hold owns the data. The second is a race the fallback may still win (an action that ends first shows it with the commit), and is not reported: during an `action`, show the wait with `isPending()` or an optimistic value, which is what a hold's stale content is for. The old content is on screen and valid the whole time; a `Loading` fallback says it is not.
8385

86+
_Note (2026-10-06):_ how a re-armed boundary treats data an earlier change still holds is deferred to a separate change; until then a re-arm behaves as described here.
87+
8488
It is possible to show the fallback beside the still-held frame anyway: a display-ahead read in `on` — `latest(id)`, `isPending()`, an optimistic signal — says the change is already on screen, so the fallback lands there too:
8589

8690
```

‎packages/signals/docs/RULES-INDEX.md‎

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

‎packages/signals/docs/SPEC-ASYNC-SEMANTICS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ The former Tier A table is these sections. Tier B/C, the fixed violations, and t
5555
- **A first load derived from a hold lands into it** (#3800): a first load born pending in a frame that read a hold lands into that hold if the hold is still live, else as its own commit; the hold commits without it. **Pending** — `fix/create-time-holds` (`91e474506`); [#3800](https://github.com/solidjs/solid/issues/3800) is open.
5656
- **A first pass under a loading boundary that has not shown content is the boundary's, not the tick's** — in a flush as outside one (A29's boundary exemption, #3540). The out-of-flush form is on `next`; the in-flush form (a fresh `Loading` over a held value shows its fallback in a flush) is **pending** — `fix/create-time-holds` (`ca71e5d9d`).
5757

58+
**A boundary that has not shown content owns its subtree — A29's boundary scope, fresh mounts (2026-10-06, maintainer ruling; amendment — #3540's L2 regression; the bullet above and A15 are unchanged outside such a boundary).** The ruling, in substance, for a boundary that has not shown content: content under it belongs to that boundary, not to any hold it reads, whichever computation does the reading (a creation pass, a re-running mount effect, the boundary's own render). While that content waits for a hold or its own first loads, it is pending: the boundary shows its fallback, and no hold waits for it. Whether the fallback is seen depends on whether the boundary's own mount is held: a boundary mounted as part of a hold (`<Show when={x()}>` with `x` held, or nested in held content) appears at that hold's commit. Outside such a boundary, A15 and the direction rule are unchanged: committed work that reads a hold joins it, never-committed work waits on every hold it read, and if no boundary would catch it, it stays hidden with the hold. The in-flush form lands with `fix/l2-3540-fresh-loading`, standalone of `fix/create-time-holds`. **Mechanism:** a first pass (`STATUS_UNINITIALIZED`) that reads a hold asks the boundaries up its chain (`GlobalQueue._fresh`: `catchStatus` with a pending status — the same walk as any pending read, so revealed boundaries it passes record it as a reader until the commit). When a loading boundary that has not shown content catches it, the pass joins pass-scoped (`passTx`), as a mount outside a flush does, instead of joining the flush: the Show that mounted the boundary publishes, and the boundary shows its fallback. A pass nothing catches joins the flush as before, so a derivation outside the boundary in the same flush still holds the tick. A render effect born held under the boundary (content bound in JSX — the tree never reads the held value) is caught the same way, so the boundary does not reveal empty content, in a flush or out of one; its output's first pass shows the fallback whenever it has collected readers. A flush that set `passTx` clears it at its end, so the boundary's hold does not merge with a later tick's. `isPending` of the boundary's value is false while its fallback shows, as for a boundary showing its fallback over a first load; `latest()` of content under it is A11's, unchanged (the derivation staged in the hold). The `direction-rule-probe` pins are unchanged. **Known gaps** (pinned `it.fails`, the same on next): a boundary mounted by a pass that itself joined the hold (a memo created in the mount that reads the hold) shows its fallback now rather than appearing at the hold's commit; a boundary mounted by a flight's hold, top-level or nested, shows its fallback for a frame at the commit. **Re-arm (2026-10-06, deferred):** the ruling's `on` part — content under a boundary that an `on` change has re-armed, committed content included, belongs to that boundary — is deferred to a separate change pending its ruling; until then a re-arm behaves as on next, and its shapes are pinned `it.fails` with the ruled display. Open: a boundary a verdict reader mounts (`<Show when={latest(x) > 0}>` over an action's write) is created by verdict-lane work, and its first passes are routed into that lane (`recompute`'s first-pass lane rule), whose world is the proposal: it shows the held derivation now rather than its fallback (mount-under-hold `verdict` family; the same on pre-L2 and next). The fix belongs to the first-pass lane rule, with #3835's. **Pinned by:** `tests/loading-fallback-in-flush-3540.test.ts` (in a flush and from mainline: through a memo, directly, bound; nested under a Loading that has shown content; a derivation outside the boundary still holds the tick; the boundary's hold stays its own; catchers at any depth — unrevealed, revealed, plain, and re-armed in flight; boundaries mounted by the hold; no catcher; `isPending` and `latest` on each; a read made pending before the flush joins its hold, and the #1078, #476/#1674 fuzzer findings; the re-arm shapes, pinned `it.fails`); `tests/loading-on-frame-following-3540.test.ts` (3b, 3c: re-arm over an earlier change's flight or staged write, pinned `it.fails` but for the inside-the-action control); `packages/web/test/loading-fallback-in-flush-3540.spec.tsx`.
59+
5860
**Not yet one-way (recorded, not ruled).** The frame of a tick is still one transaction (the tick ruling above stands), so two shapes keep the hold waiting on first loads it never needed:
5961

6062
- **Same tick:** mounts created outside a flush in one tick — two mounts over the held value, or a mount and a sync reader — share the tick's frame. The frame joins the hold, and the hold waits on the mounts' first loads.

‎packages/signals/src/boundaries.ts‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function redraw(b: Boundary): void {
203203
/** GlobalQueue._catch: status from a frame reader, nearest boundary first.
204204
* A loading boundary on the way records a pending reader whether or not it
205205
* catches it (its `on` may collect it later). */
206-
function catchStatus(node: Computed<any>, flags: number, error: unknown): boolean {
206+
function catchStatus(node: Computed<any>, flags: number, error?: unknown): boolean {
207207
if (flags === 0) {
208208
// A status cleared. Judged by the node's status now, against each
209209
// boundary's own rule (`unsettled`) — the error path clears pending
@@ -596,25 +596,23 @@ function createBoundary<T>(
596596
}
597597
if (isCollecting(b)) {
598598
// A29's boundary exemption (#3540): a boundary MOUNTED over a held
599-
// value (its first pass; the tree born held) shows its fallback now
600-
// and the content at the commit — entering the transaction would
601-
// make the output itself born held, and nothing would show until
602-
// the commit. (The seam keeps a held reader until it is committed.)
603-
// A boundary with a committed value reads a held tree and enters:
604-
// the outside sees its committed value until the landing, which
605-
// reveals the content — a fallback staged earlier is replaced ahead
606-
// of the commit and never shown.
599+
// value (its first pass; a first pass under it that read a hold was
600+
// collected, `joinPass` — the tree's own, or a render effect's that
601+
// binds the content) shows its fallback now and the content at the
602+
// commit — entering the transaction would make the output itself
603+
// born held, and nothing would show until the commit. The seam
604+
// keeps a held reader until it is committed, then re-derives this
605+
// pass. A boundary with a committed value reads a held tree and
606+
// enters: the outside sees its committed value until the landing,
607+
// which reveals the content — a fallback staged earlier is replaced
608+
// ahead of the commit and never shown.
607609
const self = getOwner() as Computed<any>;
608610
if (
609-
tree._config & CONFIG_HELD &&
611+
b._readers.size !== 0 &&
610612
self._statusFlags & STATUS_UNINITIALIZED &&
611613
!(self._config & CONFIG_HELD)
612-
) {
613-
// The seam re-derives this pass once; by then the fallback is
614-
// the committed value, and the next pass enters.
615-
collecting.add(b);
614+
)
616615
return fallback(b);
617-
}
618616
// Readers under it still unready: the fallback, the tree untouched.
619617
// The seam re-derives this pass when they settle.
620618
if (prune(b, true) !== 0) return fallback(b);
@@ -776,6 +774,8 @@ export function createErrorBoundary<T, U>(
776774
// Installed at module evaluation — present exactly when something imports a
777775
// boundary. An app without one pays the three null checks and nothing else.
778776
GlobalQueue._catch = catchStatus;
777+
GlobalQueue._fresh = node =>
778+
node._statusFlags & STATUS_UNINITIALIZED && catchStatus(node, STATUS_PENDING);
779779
GlobalQueue._hidden = hidden;
780780
GlobalQueue._boundarySeam = boundarySeam;
781781
GlobalQueue._heldRun = heldRun;

‎packages/signals/src/core/core.ts‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -943,10 +943,18 @@ export function ext(el: { _x: NodeExtension | null }): NodeExtension {
943943
* reader is a render effect. A render effect is the frame, not a derivation
944944
* (rule 3): in that transaction's own flush, or born into it (uninitialized,
945945
* A29), it reads the staged value and holds nothing of its own; otherwise it
946-
* reads the committed value instead (`frameRead`). */
946+
* reads the committed value instead (`frameRead`). A node born into the
947+
* future has no committed value: every reader joins it. A first pass is
948+
* something not ready under a loading boundary that has not shown content:
949+
* the boundary collects it and shows its fallback, and the pass is the
950+
* boundary's, not the tick's (A29's boundary exemption, #3540). */
947951
function joinPass(c: Computed<any>, el: Signal<any> | Computed<any>): void {
948952
c._flags |= REACTIVE_JOINED;
949-
if ((c as any)._type !== EFFECT_RENDER) joinPassTx(txOf(el));
953+
if (
954+
(el as Computed<any>)._statusFlags & STATUS_UNINITIALIZED ||
955+
(c as any)._type !== EFFECT_RENDER
956+
)
957+
joinPassTx(txOf(el), GlobalQueue._fresh?.(c));
950958
}
951959

952960
/** A15's stale reader (shared-hole and reveal corollaries): a render effect
@@ -1653,11 +1661,9 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
16531661
!(el._config & CONFIG_OVERRIDE) &&
16541662
!(c._config & CONFIG_CHILDREN_FORBIDDEN)
16551663
) {
1656-
if (owner._statusFlags & STATUS_UNINITIALIZED) {
1657-
(c as Computed<any>)._flags |= REACTIVE_JOINED;
1658-
joinPassTx(txOf(el));
1659-
} else if (frameRead(c as Computed<any>, el)) committed = true;
1660-
else joinPass(c as Computed<any>, el);
1664+
if (owner._statusFlags & STATUS_UNINITIALIZED || !frameRead(c as Computed<any>, el))
1665+
joinPass(c as Computed<any>, el);
1666+
else committed = true;
16611667
}
16621668
}
16631669
// Lanes: a lane's node (after the pull — the node is current). NOT_PENDING

‎packages/signals/src/core/scheduler.ts‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,15 @@ export let flushTransaction: Transaction | null = null;
173173
* into it, and nothing else in the tick is — a write made after the mount
174174
* is a mainline write, a render effect mounted beside it a stale reader.
175175
* Inside a flush, or in a tick that already has its transaction (an
176-
* action's body), the frame joins instead (`flushTransaction`). Cleared by
177-
* the flush the join schedules. */
176+
* action's body), the frame joins instead (`flushTransaction`) — except a
177+
* first pass a loading boundary that has not shown content catches (`own`,
178+
* A29's boundary exemption, #3540): it is the boundary's, not the tick's,
179+
* and a flush that has joined nothing keeps it pass-scoped as outside one.
180+
* Cleared by the flush the join schedules, and at the end of a flush that
181+
* set it. */
178182
export let passTx: Transaction | null = null;
179-
export function joinPassTx(t: Transaction): void {
180-
if (globalQueue._running || flushTransaction !== null) return joinFuture(t);
183+
export function joinPassTx(t: Transaction, own?: unknown): void {
184+
if ((globalQueue._running && !own) || flushTransaction !== null) return joinFuture(t);
181185
if (passTx === null) passTx = resolveTx(t);
182186
else merge(resolveTx(t), passTx);
183187
schedule();
@@ -658,13 +662,15 @@ export class GlobalQueue implements IQueue {
658662
// Boundaries (boundaries.ts): the display consumers between an observer
659663
// and the root. `_catch` — status from a frame reader, nearest boundary
660664
// first (true: caught, the root never hears of it; a clear — flags 0 —
661-
// settles the reader there); `_hidden` — a frame reader behind a fallback
662-
// is not on screen and holds nothing; `_boundarySeam` — the seam's sweep
663-
// (readers gone or settled without a pass reveal; an `on` re-arm
664-
// resolves).
665+
// settles the reader there); `_fresh` — a pass that read a hold (true: a
666+
// first pass a loading boundary that has not shown content caught,
667+
// `joinPass`); `_hidden` — a frame reader behind a fallback is not on
668+
// screen and holds nothing; `_boundarySeam` — the seam's sweep (readers
669+
// gone or settled without a pass reveal; an `on` re-arm resolves).
665670
declare static _catch:
666671
| ((node: Computed<any>, flags: number, error: unknown) => boolean)
667672
| undefined;
673+
declare static _fresh: ((node: Computed<any>) => unknown) | undefined;
668674
declare static _hidden: ((r: Computed<any>) => boolean) | undefined;
669675
declare static _boundarySeam: (() => void) | undefined;
670676
// `_heldRun` — a queued run under a fallback-showing boundary waits for
@@ -710,6 +716,7 @@ export class GlobalQueue implements IQueue {
710716
if (__DEV__) DEV.hooks.onUpdate?.();
711717
} finally {
712718
this._running = false;
719+
passTx = null;
713720
}
714721
}
715722
/** L2 — the seam: end of the pure phase. Commit this flush's staged nodes,

0 commit comments

Comments
 (0)