You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6b7da5e
Browse filesBrowse the repository at this point in the historyBrowse files
A memo pulled inside `isPending()` now computes as its own pass (A31): the probe's state no longer leaks into it, so a `latest()` it calls doesn't join the hold through the probe, and its reads don't answer the outer `isPending` (#4429).
Copy file name to clipboardExpand all lines: packages/signals/docs/RULES-DERIVED.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,6 +360,20 @@ A first load that rejects has no previous content to keep: born held (D-2), it s
360
360
361
361
**Deviation today.** An untracked read of a derived store's property (`createStore(fn)`, projections) throws a held rejection before its frame; the store's effect and the screen do wait. Pinned `it.fails` in `tests/error-is-an-answer.test.ts`. The standalone cases from #3886's audit (a write to a failed writable memo, error-wrapper formatting, comparator release, snapshot capture) are not this rule. **Status:** standing.
362
362
363
+
### D-42. A reactive read is not an `await`: `try/catch` around it is not a channel
A tracked read of a source that is pending or errored throws, and the throw is addressed to the graph, not to the code around the read. `NotReadyError` is how the read suspends — to an armed boundary, or into the hold (F-2, F-4); an error is how it reaches `<Errored>` or the effect's error arm (F-12). Wrapping the read in `try/catch` — in a memo, a render effect, a component body, a store derive — as one would wrap an `await`, is not supported, and not because it is forbidden: it is unreliable by construction. When a source goes pending or errored, its dependents are _marked_ with that status and do not run — the status rides the edge so that every dependent is not re-executed just to re-throw (the point of the design: no downstream over-execution). The computation is bypassed; its catch never sees the change. The catch runs only when the computation happens to run for some other reason while the source is already in that state — its creation, another input of its own changing — so the same code catches on one pass and is bypassed on the next (S-47: a first load is caught; the re-ask of the same source is held through the catching memo as if the catch were not there; an error under a catching memo reaches the boundary; a catching memo created over an already-errored source catches).
368
+
369
+
And when the catch does run it severs the channel: the computation completes with a value computed without the answer, and nothing records that it needed one. The first load is masked — no fallback enters, nothing holds, a `<Loading>` above never sees it; what is downstream reads the substitute as a real value; an error never reaches `<Errored>`, so SSR cannot know the tree failed (the 1.x `resource.error` split, removed in 2.0). On the browser build the dependency registered before the throw, so the computation re-runs at the landing and the mistake heals; on a build with no subscription graph — the server — nothing retries, and the substitute is the answer (#3073, derives).
370
+
371
+
What the author has instead: `isPending(x)` to branch on readiness; `latest(x)` to show ahead or to see a staged error early (D-22, D-41); `<Loading>`, `<Errored>` and `createEffect`'s error arm as the catchers (F-4, F-12, D-38). `try/catch` belongs where something is actually awaited — an action body (`yield refresh(x)` throws back at the yield), an event handler, `resolve()`/`until()`/`refresh()` (D-31). `NotReadyError` is exported for interop layers that re-throw it, not as an app-code catch; the runtime's own catches (`isPending`/`latest` unowned, A16) are the mechanism, not a license.
372
+
373
+
**What it does not say.** It does not say catching is detected: nothing warns today — a computation that completes after a `NotReadyError` or a source's error was thrown into it is indistinguishable from one that never read the source (a dev diagnostic is a runtime change, open). It does not say a derivation can never observe an error: `latest(x)` throws a staged error (D-41), and a `createEffect` error arm sees compute-phase errors (D-38). It does not say a dependent never re-runs on a status change: a verdict reader, a boundary output and a kept-tail link re-derive (`propagateStatus`), and a catch in one of those sees the change — that it does is the mechanism's business, not a contract.
374
+
375
+
**Collapses:**`05-async-data.md` "Error handling" (one path; the 1.x split), `04-stores.md` "A derive must never swallow `NotReadyError`" (#3073 — the derive form of this rule), the `NotReadyError` JSDoc, [A16](./SPEC-ASYNC-SEMANTICS.md#a16-ispending-never-throws-in-untracked-contexts)'s swallow scope (B5a, #2928). **Status:** standing; the bypass is pinned as it is in `tests/try-catch-reactive-read.test.ts`.
Copy file name to clipboardExpand all lines: packages/signals/docs/RULES-FUNDAMENTALS.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,11 +120,11 @@ These are the only words the fundamentals use. Internal names (transaction, stag
120
120
121
121
## F-12. An error is a boundary returning to its fallback; pending is not an error
122
122
123
-
**Immutable.** An error thrown by content under an `<Errored>` sends that boundary to its error fallback, which is then the display (F-3): readers behind it hold nothing. A pending read is never an error: `<Errored>` does not catch it and never shows its fallback for a wait, and `ASYNC_OUTSIDE_LOADING_BOUNDARY` is a warning, not a failure. An error that escapes every boundary halts the reactive system (`REACTIVITY_HALTED`); later writes are ignored. In effects, compute-phase errors can be intercepted (`createEffect`'s error arm) and are logged and skipped when they are not; effect-phase errors escalate to the nearest boundary.
123
+
**Immutable.** An error thrown by content under an `<Errored>` sends that boundary to its error fallback, which is then the display (F-3): readers behind it hold nothing. A pending read is never an error: `<Errored>` does not catch it and never shows its fallback for a wait, and `ASYNC_OUTSIDE_LOADING_BOUNDARY` is a warning, not a failure. An error that escapes every boundary halts the reactive system (`REACTIVITY_HALTED`); later writes are ignored. In effects, compute-phase errors can be intercepted (`createEffect`'s error arm) and are logged and skipped when they are not; effect-phase errors escalate to the nearest boundary. A read's throw — pending or error — is addressed to the graph, not to the code around the read: the boundaries and the error arm are the catchers, and `try/catch` around a reactive read is not a channel — a dependent of a source that goes pending or errored is marked, not run, so the catch is bypassed (amended 2026-10-30, D-42).
124
124
125
-
**What it does not say.** It does not say an error clears on the next write — the error fallback stays until a new answer replaces the errored one (D-39). It does not say an error shows before the frame it belongs to: an error is an answer — it ends the wait like a value, and it shows when a value would (D-41). It does not say a `try`/`catch` in a memo or effect catches an upstream memo's error: an error is the upstream memo's status, not a throw the reader owns, so a reader that reads an errored memo is errored with it whether or not it catches the read, and recovery goes through `<Errored>` (ruled 2026-10-29, #4410). A rejected promise the reader awaits itself is the reader's own throw: `try`/`catch` around the `await` catches it like any exception.
125
+
**What it does not say.** It does not say an error clears on the next write — the error fallback stays until a new answer replaces the errored one (D-39). It does not say an error shows before the frame it belongs to: an error is an answer — it ends the wait like a value, and it shows when a value would (D-41). It does not say a `try`/`catch` in a memo or effect catches an upstream memo's error: an error is the upstream memo's status, not a throw the reader owns, so a reader that reads an errored memo is errored with it whether or not it catches the read, and recovery goes through `<Errored>` (ruled 2026-10-29, #4410). A rejected promise the reader awaits itself is the reader's own throw: `try`/`catch` around the `await` catches it like any exception. It does not say catching is forbidden or detected — it says it is not how a pending or an error is handled, and that code written as if it were runs on some passes and not others (D-42).
0 commit comments