From 5cbe08c36e72aef3e3d404ba4bfd413b01ad312f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 06:55:41 +0000 Subject: [PATCH] docs: catch up with solid rc.22 for stable Regenerates the reference and diagnostics pages against solid next 0f6a978 (rc.22 plus four internal fixes) and fixes guides that rc.22 made wrong. - Generator: move the createDeferred caveats from CANONICAL_ROUTES to ENTRY_CAVEATS (#1693 put them in the route map, which broke sync:ref); add setTrustedTypesPolicy as a page, fold FlushChange and FlushLive into attribution, hide six @internal re-exports. - New pages: setTrustedTypesPolicy, and diagnostics CAUGHT_REACTIVE_READ, INVALID_HTML_NESTING, OPTIMISTIC_WRITE_BEFORE_LOAD, OPTIMISTIC_WRITE_WHILE_LOADING, STORE_WRITE_THROUGH_LOADING. - onFlush: each callback runs in its own flush (#4764). - Ref callbacks run in the creating pass and own nothing; an effect or onCleanup there throws in dev (#4768). - From React: handler expressions warn STRICT_READ_UNTRACKED (#4838). - Rendering and SSR: a common-problem entry for Trusted Types. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0117BoWNxvzLd4SQ3p3kgdA1 --- scripts/extract-solid-ref.mjs | 30 +++- .../(2)concepts/(1)components-and-jsx.mdx | 9 +- .../(2)concepts/(6)rendering-and-ssr.mdx | 17 ++ .../(13)integrate-non-solid-code.mdx | 8 +- src/routes/(6)migration/(5)from-react.mdx | 2 +- .../(3)lifecycle-actions/on-flush.mdx | 3 +- .../(7)diagnostics-dev-hooks/attribution.mdx | 72 ++++++++- .../(7)diagnostics-dev-hooks/dev.mdx | 17 ++ .../(7)diagnostics-dev-hooks/observe.mdx | 15 +- .../(1)solid-js/(8)diagnostics/(0)index.mdx | 149 +++++++++--------- .../(8)diagnostics/caught-reactive-read.mdx | 54 +++++++ .../cleanup-in-forbidden-scope.mdx | 5 +- .../(8)diagnostics/invalid-html-nesting.mdx | 61 +++++++ .../optimistic-write-before-load.mdx | 50 ++++++ .../optimistic-write-while-loading.mdx | 51 ++++++ .../primitive-in-effect-callback.mdx | 5 +- .../store-write-through-loading.mdx | 51 ++++++ .../(8)diagnostics/strict-read-untracked.mdx | 3 + .../(1)rendering-ssr/render-to-stream.mdx | 17 +- .../(1)rendering-ssr/render-to-string.mdx | 9 +- .../set-trusted-types-policy.mdx | 65 ++++++++ .../(2)solid-web/(3)components/portal.mdx | 2 +- .../(2)solid-web/(4)jsx-properties/(0)ref.mdx | 6 +- 23 files changed, 597 insertions(+), 104 deletions(-) create mode 100644 src/routes/reference/(1)solid-js/(8)diagnostics/caught-reactive-read.mdx create mode 100644 src/routes/reference/(1)solid-js/(8)diagnostics/invalid-html-nesting.mdx create mode 100644 src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-before-load.mdx create mode 100644 src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-while-loading.mdx create mode 100644 src/routes/reference/(1)solid-js/(8)diagnostics/store-write-through-loading.mdx create mode 100644 src/routes/reference/(2)solid-web/(1)rendering-ssr/set-trusted-types-policy.mdx diff --git a/scripts/extract-solid-ref.mjs b/scripts/extract-solid-ref.mjs index cbea4d00f7..c81e296425 100644 --- a/scripts/extract-solid-ref.mjs +++ b/scripts/extract-solid-ref.mjs @@ -104,11 +104,6 @@ const CANONICAL_ROUTES = { createEffect: ["reactivity/create-effect.mdx", "Reactivity"], createDeferred: ["reactivity/create-deferred.mdx", "Reactivity"], createMemo: ["reactivity/create-memo.mdx", "Reactivity"], - createDeferred: [ - "`createDeferred` is not `latest` on every consumer. `latest` shows a value now while the update stays held for every other reader; a deferred memo is not part of the update, so nothing waits for it. See [Let a panel lag](/concepts/async-reactivity#let-a-panel-lag-createdeferred).", - "Use it for data that may fall behind the rest of the page without making it wrong, such as an independent widget or a feed. Data that must agree with the rest of the page belongs in `createMemo`.", - "Its first load still suspends to the nearest `Loading` boundary, unless `loadingValue` is set.", - ], createOptimistic: ["reactivity/create-optimistic.mdx", "Reactivity"], createSignal: ["reactivity/create-signal.mdx", "Reactivity"], flush: ["reactivity/flush.mdx", "Reactivity"], @@ -169,6 +164,10 @@ const CANONICAL_ROUTES = { render: ["rendering-ssr/render.mdx", "Rendering & SSR"], renderToStream: ["rendering-ssr/render-to-stream.mdx", "Rendering & SSR"], renderToString: ["rendering-ssr/render-to-string.mdx", "Rendering & SSR"], + setTrustedTypesPolicy: [ + "rendering-ssr/set-trusted-types-policy.mdx", + "Rendering & SSR", + ], takeHydrationValue: [ "rendering-ssr/take-hydration-value.mdx", "Rendering & SSR", @@ -529,6 +528,8 @@ const FOLD_INTO = { FlightEvent: "attribution", FlightLink: "attribution", FlushEvent: "attribution", + FlushChange: "attribution", + FlushLive: "attribution", GraphEvent: "attribution", HeldWrite: "attribution", HoldEvent: "attribution", @@ -784,6 +785,16 @@ const HIDDEN_EXPORTS = new Set([ "SOURCE_PROXY", "SourceKind", "isStatic", + // @internal re-exports (`export { … } from`) the scan does not see as + // internal: head-registry swap hooks (#4873), the stateful-prop hold read + // (#4872), the verdict window read (#4648), and the dev strict window + // compiled event handler expressions read through (#4838). + "heldRead", + "isHidden", + "setSwapHook", + "verdict", + "strictReadTracked", + "strictHandler", // The root error hook's storage key; configureClientErrors is the API. "ROOT_ERROR_HOOK", // Engine-side owner labelling; records carry the result as `ownerPath`. @@ -1778,6 +1789,11 @@ const RETURN_DOCS = { // Caveats rendered as a bullet list under `## Caveats`. const ENTRY_CAVEATS = { + createDeferred: [ + "`createDeferred` is not `latest` on every consumer. `latest` shows a value now while the update stays held for every other reader; a deferred memo is not part of the update, so nothing waits for it. See [Let a panel lag](/concepts/async-reactivity#let-a-panel-lag-createdeferred).", + "Use it for data that may fall behind the rest of the page without making it wrong, such as an independent widget or a feed. Data that must agree with the rest of the page belongs in `createMemo`.", + "Its first load still suspends to the nearest `Loading` boundary, unless `loadingValue` is set.", + ], createSignal: [ "Passing a function to the setter treats it as an updater. To store a function as the value, wrap it: `setHandler(() => fn)`.", "A read right after a write returns the old value until the queue flushes. Derive the value you need instead of reading it back, or call `flush()` in tests.", @@ -2042,8 +2058,8 @@ const COMPONENT_PROBLEMS = { "/concepts/components-and-jsx#show-renders-the-fallback-even-though-the-value-is-set", ], refCallback: [ - "An effect or `onCleanup` inside a `ref` callback never runs", - "/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-never-runs", + "An effect or `onCleanup` inside a `ref` callback throws", + "/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-throws", ], }; const LIST_PROBLEMS = { diff --git a/src/routes/(2)concepts/(1)components-and-jsx.mdx b/src/routes/(2)concepts/(1)components-and-jsx.mdx index c6861a84dc..6a6ea91de5 100644 --- a/src/routes/(2)concepts/(1)components-and-jsx.mdx +++ b/src/routes/(2)concepts/(1)components-and-jsx.mdx @@ -182,8 +182,8 @@ function SearchField() { A directive is a function you pass to `ref`; there is no separate directive syntax. A directive factory creates owned reactive primitives during component setup and returns the callback that applies the directive to an element. -Ref callbacks run untracked and without an owner. -Do not create effects or register cleanup inside the returned callback. +A ref callback runs untracked, in the pass that creates the element, and it owns nothing. +Do not create effects or register cleanup inside the returned callback: in development, creating a memo, effect, or root there throws `PRIMITIVE_IN_EFFECT_CALLBACK`, and `onCleanup` throws `CLEANUP_IN_FORBIDDEN_SCOPE`. Create them in the factory, where they belong to the component owner. ```tsx @@ -583,9 +583,10 @@ Keep item identity stable, pass a key function that reads an `id`, or use a [sto A value of `0` or an empty string is falsy and shows the fallback. Compare explicitly, for example `when={count() !== undefined}`, or use `Switch` and `Match` when there are several cases. -### An effect or `onCleanup` inside a `ref` callback never runs +### An effect or `onCleanup` inside a `ref` callback throws -Ref callbacks run untracked and without an owner, so primitives created there are never disposed. +A ref callback owns nothing, so nothing could dispose a primitive created there. +In development, a memo, effect, or root created in a ref throws [`PRIMITIVE_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/primitive-in-effect-callback), and `onCleanup` throws [`CLEANUP_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/cleanup-in-forbidden-scope). Create the effect in a directive factory during component setup and return the callback that stores the element. See [Refs and directives](#refs-and-directives). diff --git a/src/routes/(2)concepts/(6)rendering-and-ssr.mdx b/src/routes/(2)concepts/(6)rendering-and-ssr.mdx index bf4678f091..9fa8c99036 100644 --- a/src/routes/(2)concepts/(6)rendering-and-ssr.mdx +++ b/src/routes/(2)concepts/(6)rendering-and-ssr.mdx @@ -355,6 +355,23 @@ Include it once, before the application markup. An async read outside any `Loading` boundary blocks the stream's shell. Put a boundary around the region that depends on the read, so the shell carries a fallback and the content streams later. +### `This document requires 'TrustedHTML' assignment` in the console + +The page sends a Content Security Policy with `require-trusted-types-for 'script'`, and the browser rejects the plain string a compiled template assigns to `innerHTML`. +Create a Trusted Types policy in the client entry and pass it to [`setTrustedTypesPolicy`](/reference/solid-web/rendering-ssr/set-trusted-types-policy) before the first `render` or `hydrate`: + +```ts +import { setTrustedTypesPolicy } from "@solidjs/web"; + +setTrustedTypesPolicy( + trustedTypes.createPolicy("my-app", { createHTML: (html) => html }) +); +``` + +Solid then assigns the policy's `TrustedHTML` for template markup, for server component HTML, and for the `html` tagged template. +On the server the call does nothing, so an isomorphic entry can make it. +Name the policy in the page's `trusted-types` directive. + ### A promise cached while the page hydrated never resolves A compute function stored a promise in a cache that outlives it, and the store happened during hydration's tracking run, where promises are stand-ins. diff --git a/src/routes/(5)guides/(13)integrate-non-solid-code.mdx b/src/routes/(5)guides/(13)integrate-non-solid-code.mdx index b432d3cf32..17efe6fd18 100644 --- a/src/routes/(5)guides/(13)integrate-non-solid-code.mdx +++ b/src/routes/(5)guides/(13)integrate-non-solid-code.mdx @@ -29,7 +29,7 @@ The element exists after the JSX has been evaluated; a `ref` callback runs at th The [`ref` reference](/reference/solid-web/jsx-properties/ref) lists the accepted forms, and [Refs and directives](/concepts/components-and-jsx#refs-and-directives) shows how a directive factory owns setup for an element. Two things matter for every integration on this page. -A `ref` callback runs untracked and without an owner, so do not create effects or register cleanup in it. +A `ref` callback runs untracked and owns nothing, so do not create effects or register cleanup in it. And setup that needs the element to be in the document belongs in `onSettled`, which runs after the first render has settled. ## Create the instance once, update it in an effect @@ -301,11 +301,11 @@ Use the `prop:` namespace, `prop:disabledDates={holidays()}`, so Solid assigns t Add the listener from a `ref` directive with the exact name. If the event uses a delegated name such as `input` and the element dispatches it without `bubbles: true`, the root listener never sees it either. -### An effect or cleanup inside a `ref` callback never runs +### An effect or cleanup inside a `ref` callback throws -Ref callbacks run without an owner. +A ref callback owns nothing, so in development an effect or `onCleanup` created there throws. Move the setup into `onSettled` in the component body, or into a directive factory that returns the callback. -See [An effect or onCleanup inside a ref callback never runs](/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-never-runs). +See [An effect or onCleanup inside a ref callback throws](/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-throws). ## Recap diff --git a/src/routes/(6)migration/(5)from-react.mdx b/src/routes/(6)migration/(5)from-react.mdx index a5917dab3c..ee2d09ed54 100644 --- a/src/routes/(6)migration/(5)from-react.mdx +++ b/src/routes/(6)migration/(5)from-react.mdx @@ -1218,7 +1218,7 @@ Development builds report most of them by code; codes marked "attribution" appea | Reading a signal after `await` in an async memo | The memo does not re-run when it changes | [`UNTRACKED_READ_AFTER_AWAIT`](/reference/solid-js/diagnostics/untracked-read-after-await) (V8 engines) | | Writing a store outside its setter | The write is ignored | [`STORE_WRITE_OUTSIDE_SETTER`](/reference/solid-js/diagnostics/store-write-outside-setter) | | `createContext(undefined)` for an optional context | `useContext` throws without a provider | `ContextNotFoundError`; use `null` as the default | -| `onClick={ready() ? save : wait}` | The first handler stays bound | Nothing; decide inside one handler | +| `onClick={ready() ? save : wait}` | The first handler stays bound | [`STRICT_READ_UNTRACKED`](/reference/solid-js/diagnostics/strict-read-untracked); decide inside one handler | | A lowercase `onclick` | The handler is never attached | [`LOWERCASE_EVENT_ATTRIBUTE`](/reference/solid-js/diagnostics/lowercase-event-attribute) | | A controlled input whose handler rejects a keystroke | The rejected text stays in the field | Nothing; assign `event.currentTarget.value` in the handler | | `value={props.name} onChange={commit}` with no draft signal | When another attribute in the same template changes, the binding re-runs and erases the typed text | [`UNCOMMITTED_INPUT_OVERWRITTEN`](/reference/solid-js/diagnostics/uncommitted-input-overwritten); write a draft signal from `onInput`, or use `defaultValue` | diff --git a/src/routes/reference/(1)solid-js/(3)lifecycle-actions/on-flush.mdx b/src/routes/reference/(1)solid-js/(3)lifecycle-actions/on-flush.mdx index 93241acdbe..3cc61916ca 100644 --- a/src/routes/reference/(1)solid-js/(3)lifecycle-actions/on-flush.mdx +++ b/src/routes/reference/(1)solid-js/(3)lifecycle-actions/on-flush.mdx @@ -39,7 +39,8 @@ component body or a computation it warns in dev: use `onSettled` there. - A write in the callback lands after any write made inline in the same frame. Don't write the same signal both inside and outside it; use a functional setter if the order matters. -- Several `onFlush` callbacks run in call order and batch into one flush. +- Several `onFlush` callbacks run in call order, each in its own flush: + async work one callback starts does not hold another's writes. - `queueMicrotask` is not a substitute: called before the frame's first write, it runs before that flush and its write joins it. diff --git a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/attribution.mdx b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/attribution.mdx index bc851b3d7f..e91f094058 100644 --- a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/attribution.mdx +++ b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/attribution.mdx @@ -350,7 +350,7 @@ interface AttributionCostTables { - **Type:** `ScopeCost[]` -Ranked by self-time. +Ranked by self-time. Collected scopes share one row per name and kind. #### `writes` @@ -1442,6 +1442,43 @@ Summed and worst wall time of landed flights (ms). - **Type:** `number` +### `FlushChange` + +One node whose shown value a drain changed (`FlushEvent.changes`). + +```ts +interface FlushChange { + nodeId: number; + nodeName: string; + key?: string; + origin?: ChangeOrigin; +} +``` + +#### `nodeId` + +- **Type:** `number` + +The node, in the id space of `RerunEvent.nodeId` and `ChangeRecord.nodeId`. + +#### `nodeName` + +- **Type:** `string` + +#### `key` + +- **Type:** `string` + +A store property's node: the property, as a string. + +#### `origin` + +- **Type:** `ChangeOrigin` + +Who staged the value that is now shown — the action step, effect, +interaction or navigation — when one was open. A held write keeps the +origin it was staged under, so a landing's changes name their action. + ### `FlushEvent` One `flush()` drain: from the scheduler picking up scheduled work until @@ -1459,6 +1496,7 @@ interface FlushEvent { created: number; held: boolean; interaction?: ChangeOrigin; + changes: FlushChange[]; } ``` @@ -1500,6 +1538,38 @@ The interaction every recorded run of the drain traced to, when there was exactly one; absent when none did, or when runs for several interactions shared the drain. +#### `changes` + +- **Type:** `FlushChange[]` + +What the drain changed on screen: each signal, memo or store property +whose shown value differs from what it showed before the drain — a +commit, a held update's landing, an optimistic value appearing or +lifting. One entry per node, in no promised order. Nodes that got their +first value, and effects, are not listed. + +### `FlushLive` + +Beside a `flush` record (`OBSERVE.records.subscribe("flush", (event, live) => …)`): +the live side of `event.changes`, index for index — the node, and, for a +listener that subscribed with `{ bodies: true }`, the values before and +after. The values are live, not copies: a store's objects keep changing +after the record, so a listener that keeps them copies them on delivery. + +```ts +interface FlushLive { + changes: { + node: Signal | Computed; + prev?: unknown; + value?: unknown; + }[]; +} +``` + +#### `changes` + +- **Type:** `{ node: Signal | Computed; prev?: unknown; value?: unknown }[]` + ### `GraphEvent` The live graph's size at a navigation's settle — the moment an app has diff --git a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/dev.mdx b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/dev.mdx index d0239c21ec..525aba0d5a 100644 --- a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/dev.mdx +++ b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/dev.mdx @@ -52,6 +52,7 @@ interface Dev { getParent: typeof getParent; getSources: typeof getSources; getObservers: typeof getObservers; + setSignal: typeof setDevSignal; report(entry: DiagnosticEvent): void; guideUrl(code: DiagnosticCode): string; } @@ -81,6 +82,16 @@ interface Dev { - **Type:** `typeof getObservers` +#### `setSignal` + +- **Type:** `typeof setDevSignal` + +Write a signal or store-slot node from outside the app's setters — +for example from a devtools state editor that only holds the node from +`getSignals` / `getSources`. Runs as an unowned write (devtools UI +events are not owned scopes). Store property slots go through the +store setter path so `onStoreNodeUpdate` and backing state stay in sync. + #### `report` - **Type:** `void` @@ -169,6 +180,7 @@ type DiagnosticCode = | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "STORE_WRITE_OUTSIDE_SETTER" + | "STORE_WRITE_THROUGH_LOADING" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" @@ -183,11 +195,13 @@ type DiagnosticCode = | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" + | "LOADING_ON_ACCESSOR" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" + | "CAUGHT_REACTIVE_READ" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" @@ -207,6 +221,8 @@ type DiagnosticCode = | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" + | "OPTIMISTIC_WRITE_BEFORE_LOAD" + | "OPTIMISTIC_WRITE_WHILE_LOADING" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" @@ -231,6 +247,7 @@ type DiagnosticCode = | "UNSCOPED_HOLE_ALLOCATED_IDS" | "LOWERCASE_EVENT_ATTRIBUTE" | "UNCOMMITTED_INPUT_OVERWRITTEN" + | "INVALID_HTML_NESTING" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT" | "ASYNC_MEMO_ELEMENT"; diff --git a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/observe.mdx b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/observe.mdx index 64e3603892..a663614990 100644 --- a/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/observe.mdx +++ b/src/routes/reference/(1)solid-js/(6)advanced/(7)diagnostics-dev-hooks/observe.mdx @@ -568,6 +568,7 @@ type DiagnosticCode = | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "STORE_WRITE_OUTSIDE_SETTER" + | "STORE_WRITE_THROUGH_LOADING" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" @@ -582,11 +583,13 @@ type DiagnosticCode = | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" + | "LOADING_ON_ACCESSOR" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" + | "CAUGHT_REACTIVE_READ" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" @@ -606,6 +609,8 @@ type DiagnosticCode = | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" + | "OPTIMISTIC_WRITE_BEFORE_LOAD" + | "OPTIMISTIC_WRITE_WHILE_LOADING" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" @@ -630,6 +635,7 @@ type DiagnosticCode = | "UNSCOPED_HOLE_ALLOCATED_IDS" | "LOWERCASE_EVENT_ATTRIBUTE" | "UNCOMMITTED_INPUT_OVERWRITTEN" + | "INVALID_HTML_NESTING" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT" | "ASYNC_MEMO_ELEMENT"; @@ -1299,8 +1305,9 @@ until `attribution.enable()`): `live` is the computation the record is about where there is one — the node that ran for `rerun`, `create` and `effect`, the async node for `flight`, the boundary's subtree for `fallback` (when the boundary reported one), the first held root signal -for `hold` (the subject the SILENT_HOLD finding names) — and `undefined` -for the records with no single subject (`flush`, `interaction`, +for `hold` (the subject the SILENT_HOLD finding names), the changed +nodes for `flush` (`FlushLive`, with their values under `bodies`) — and +`undefined` for the records with no single subject (`interaction`, `navigation`, `graph`). The records are the same objects the engine's ring buffers hold (`attribution.history(type)`), delivered synchronously the moment each is complete — a re-run at recompute end, a hold, a @@ -1317,7 +1324,7 @@ interface RecordTypes extends HostRecordTypes { rerun: { event: RerunEvent; live: Computed }; create: { event: CreateEvent; live: Computed }; effect: { event: EffectRunEvent; live: Computed }; - flush: { event: FlushEvent; live: undefined }; + flush: { event: FlushEvent; live: FlushLive }; flight: { event: FlightEvent; live: Computed }; fallback: { event: FallbackEvent; live: Computed | undefined }; interaction: { event: InteractionEvent; live: undefined }; @@ -1341,7 +1348,7 @@ interface RecordTypes extends HostRecordTypes { #### `flush` -- **Type:** `{ event: FlushEvent; live: undefined }` +- **Type:** `{ event: FlushEvent; live: FlushLive }` #### `flight` diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/(0)index.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/(0)index.mdx index 732f6777b1..7fb9615262 100644 --- a/src/routes/reference/(1)solid-js/(8)diagnostics/(0)index.mdx +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/(0)index.mdx @@ -47,75 +47,80 @@ Naming your memos and effects (`{ name }`) turns the trailing `effect` in the `i ## Codes -| Code | Kind | Severity | Trigger | -| ------------------------------------------------------------------------------------------------------ | ---------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`ABANDONED_FLIGHTS`](/reference/solid-js/diagnostics/abandoned-flights) | `responsiveness` | `warn` | One async source abandoned 3+ flights in 1s, each superseded before landing — the request-per-keystroke signature (attribution enabled) | -| [`ACTION_CALLED_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/action-called-in-owned-scope) | `write` | `error` | `action()` invoked from a component body or computation | -| [`ASYNC_MEMO_ELEMENT`](/reference/solid-js/diagnostics/async-memo-element) | `ssr` | `error` | An async memo landed on rendered output (JSX, a boundary), which cannot serialize for hydration; the memo rejects (observe + dev; rejects in every tier) | -| [`ASYNC_OUTSIDE_LOADING_BOUNDARY`](/reference/solid-js/diagnostics/async-outside-loading-boundary) | `async` | `warn` | Async computation outside Loading boundary (non-halting; root mount is deferred) | -| [`ASYNC_STORE_SETTER`](/reference/solid-js/diagnostics/async-store-setter) | `write` | `error` | Store setter callback returned a Promise (setters are synchronous transactions) | -| [`ASYNC_WATERFALL`](/reference/solid-js/diagnostics/async-waterfall) | `perf` | `info`, `warn` | 2+/3+ sequential async flights, origin-proven (attribution enabled) | -| [`CLEANUP_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/cleanup-in-forbidden-scope) | `lifecycle` | `error` | `onCleanup` inside trackedEffect/onSettled | -| [`DYNAMIC_ASYNC_COMPONENT`](/reference/solid-js/diagnostics/dynamic-async-component) | `ssr` | `error` | An async `dynamic()` source landed on a client component function, which cannot serialize for adoption; the memo rejects (observe + dev; rejects in every tier) | -| [`EFFECT_RELAY_TEAR`](/reference/solid-js/diagnostics/effect-relay-tear) | `perf` | `info`, `warn` | Reader ran twice for one root change because an effect relayed it; `warn` when derivable or repeated (attribution enabled) | -| [`EFFECT_WRITES_OWN_SOURCE`](/reference/solid-js/diagnostics/effect-writes-own-source) | `perf` | `info`, `warn` | Effect's write provably feeds back into its own inputs; `info` for multi-effect rings (attribution enabled) | -| [`FALLBACK_FLASH`](/reference/solid-js/diagnostics/fallback-flash) | `responsiveness` | `info` | A `Loading` fallback showed for under 150ms — feedback for a wait too short to need it (attribution enabled) | -| [`FLUSH_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/flush-in-effect-callback) | `lifecycle` | `warn` | `flush()` from an effect callback (no-op; the drain is already running) | -| [`FRAME_MARKER_CORRUPTED`](/reference/solid-js/diagnostics/frame-marker-corrupted) | `ssr` | `error` | Frame slot range missing its end marker on the client — nesting or an HTML rewriter (observe + dev) | -| [`GRAPH_GROWTH`](/reference/solid-js/diagnostics/graph-growth) | `perf` | `warn` | The live graph and what outlived each navigation climbed at a route's settle on 3 visits to 1.25× — something each visit leaves behind (attribution enabled) | -| [`HEAD_TAG_INVALID`](/reference/solid-js/diagnostics/head-tag-invalid) | `head` | `warn` | `useHead` registration the render could not honor; `data.reason` names the rule (dev) | -| [`HOT_SCOPE_FANOUT`](/reference/solid-js/diagnostics/hot-scope-fanout) | `perf` | `warn` | 5+/50+/500+ scopes hot from one root cause (attribution enabled) | -| [`HOT_SCOPE_RERUNS`](/reference/solid-js/diagnostics/hot-scope-reruns) | `perf` | `warn` | 120+ re-runs of one scope in 1s (attribution enabled) | -| [`HOT_SCOPE_TIME`](/reference/solid-js/diagnostics/hot-scope-time) | `perf` | `warn` | 8ms+ self-time in one scope in 1s (attribution enabled) | -| [`HUGE_FAN_IN`](/reference/solid-js/diagnostics/huge-fan-in) | `graph` | `warn` | One recompute tracked 2000 sources (always on) | -| [`HUGE_FAN_OUT`](/reference/solid-js/diagnostics/huge-fan-out) | `graph` | `warn` | One change reached 2000 live subscribers (always on), or 250 — `fanOut` — on a stamped root write (attribution enabled) | -| [`IMMUTABLE_UPDATE_IN_STORE`](/reference/solid-js/diagnostics/immutable-update-in-store) | `perf` | `warn` | Store container replaced by a mostly-identical copy (attribution enabled) | -| [`INVALID_AFFECTS_TARGET`](/reference/solid-js/diagnostics/invalid-affects-target) | `write` | `error` | `affects()` given a key path, or a key on an accessor | -| [`INVALID_REFRESH_TARGET`](/reference/solid-js/diagnostics/invalid-refresh-target) | `write` | `error` | `refresh()` target is not a source accessor or refreshable store | -| [`INVARIANT_VIOLATION`](/reference/solid-js/diagnostics/invariant-violation) | `error` | `error` | Internal consistency check failed (throws under `__TEST__`, reported in dev) | -| [`LATE_HEADER_WRITE`](/reference/solid-js/diagnostics/late-header-write) | `head` | `error` | Response header written after the head was sent; dropped (observe + dev; dev throws) | -| [`LAZY_ASSET_UNMAPPED`](/reference/solid-js/diagnostics/lazy-asset-unmapped) | `ssr` | `warn` | `lazy()` component's client assets could not be resolved for the page (dev) | -| [`LOADING_ON_ACCESSOR`](/reference/solid-js/diagnostics/loading-on-accessor) | `async` | `warn` | `` received a function (an accessor) instead of the dependency's value; it is never called, so the boundary never re-arms | -| [`LOADING_ON_OUTSIDE_HOLD`](/reference/solid-js/diagnostics/loading-on-outside-hold) | `async` | `warn` | `` changed but its data is also read outside the boundary and holds the frame: the fallback can never be seen | -| [`LONG_HOLD`](/reference/solid-js/diagnostics/long-hold) | `responsiveness` | `info`, `warn` | Acknowledged hold whose tail (last input → commit) ran 500ms+/1000ms+ (attribution enabled) | -| [`LOWERCASE_EVENT_ATTRIBUTE`](/reference/solid-js/diagnostics/lowercase-event-attribute) | `render` | `warn` | A function was set on a lowercase `on*` (or `on:`) attribute, which is not an event handler in 2.0; use `onXxx` (dev; client) | -| [`MISSING_EFFECT_FN`](/reference/solid-js/diagnostics/missing-effect-fn) | `lifecycle` | `error` | `createEffect` called without the effect function | -| [`NO_OWNER_BOUNDARY`](/reference/solid-js/diagnostics/no-owner-boundary) | `lifecycle` | `warn` | Boundary created without owner | -| [`NO_OWNER_CLEANUP`](/reference/solid-js/diagnostics/no-owner-cleanup) | `lifecycle` | `warn` | `onCleanup` called without owner | -| [`NO_OWNER_EFFECT`](/reference/solid-js/diagnostics/no-owner-effect) | `lifecycle` | `warn` | Effect created without reactive owner | -| [`ON_FLUSH_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/on-flush-in-owned-scope) | `lifecycle` | `warn` | `onFlush` called in a component body or computation (meant for event handlers and effect callbacks) | -| [`OPTIMISTIC_REVERTED`](/reference/solid-js/diagnostics/optimistic-reverted) | `responsiveness` | `info` | An optimistic value the screen showed was replaced by a different one — reverted at settle, or superseded by the truth (attribution enabled) | -| [`PENDING_ASYNC_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/pending-async-forbidden-scope) | `async` | `warn` | Pending async read in trackedEffect/onSettled | -| [`PENDING_ASYNC_UNTRACKED_READ`](/reference/solid-js/diagnostics/pending-async-untracked-read) | `async` | `error` | Reading pending async outside tracking scope | -| [`PRELOAD_DESCRIPTOR_INVALID`](/reference/solid-js/diagnostics/preload-descriptor-invalid) | `head` | `warn` | `registerAsset("preload")` descriptor broke a field rule; link dropped or field ignored (dev) | -| [`PRIMITIVE_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/primitive-in-effect-callback) | `lifecycle` | `error` | Memo, effect, or root created inside an effect callback or its cleanup, where there is no ambient owner (throws) | -| [`PRIMITIVE_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/primitive-in-forbidden-scope) | `lifecycle` | `error` | Reactive primitive created inside trackedEffect/onSettled | -| [`REACTIVE_WRITE_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/reactive-write-in-owned-scope) | `write` | `error` | Reactive write/invalidation inside component/computation | -| [`REACTIVITY_HALTED`](/reference/solid-js/diagnostics/reactivity-halted) | `error` | `error` | Uncaught error escaped every boundary; scheduling stopped (reported, cause to `reportError`) | -| [`REVEAL_IN_RENDER_TO_STRING`](/reference/solid-js/diagnostics/reveal-in-render-to-string) | `ssr` | `warn` | Nested `` with collapsed/together under `renderToString` (dev) | -| [`RUN_WITH_DISPOSED_OWNER`](/reference/solid-js/diagnostics/run-with-disposed-owner) | `owner` | `warn` | `runWithOwner` with disposed owner | -| [`SERVER_ERROR_SANITIZED`](/reference/solid-js/diagnostics/server-error-sanitized) | `ssr` | `error`, `info` | Error replaced with the generic Error on the wire — `data.source` `"server-function"` (`error`) or `"ssr"` (`info`); `data.error` is the original (observe + dev) | -| [`SERVER_WRITE`](/reference/solid-js/diagnostics/server-write) | `write` | `warn` | Signal/store/optimistic setter ran during a server render; inert, will throw (dev; once per category) | -| [`SETTLE_WALK_UNINITIALIZED_SOURCE`](/reference/solid-js/diagnostics/settle-walk-uninitialized-source) | `lifecycle` | `error` | Internal: settle walk reached a source that never produced a value (reported) | -| [`SETTLED_CLEANUP_UNOWNED`](/reference/solid-js/diagnostics/settled-cleanup-unowned) | `lifecycle` | `error` | `onSettled` returned a cleanup in an unowned (out-of-band) scope | -| [`SILENT_HOLD`](/reference/solid-js/diagnostics/silent-hold) | `responsiveness` | `info`, `warn` | Write held 100ms+/200ms+ by pending async with no on-screen acknowledgement (attribution enabled) | -| [`SSR_BOUNDARY_WATERFALL`](/reference/solid-js/diagnostics/ssr-boundary-waterfall) | `ssr` | `info`, `warn` | A `` boundary needed 3+/4+ render passes — 2+/3+ sequential async waits (dev) | -| [`SSR_CLIENT_CONTENT_MASKED`](/reference/solid-js/diagnostics/ssr-client-content-masked) | `ssr` | `warn` | Client-only content in a `` surfaced only after a server wait; the server's work was discarded (dev) | -| [`SSR_LIVE_HOLE_LATCHED`](/reference/solid-js/diagnostics/ssr-live-hole-latched) | `ssr` | `warn` | A live hole that shipped its markers was closed by the impurity gate on re-run and stopped updating (dev) | -| [`SSR_RENDER_ERROR_CONTAINED`](/reference/solid-js/diagnostics/ssr-render-error-contained) | `ssr` | `error` | Server render error routed by a boundary: `data.handling` fallback / client / failed (observe + dev) | -| [`SSR_STREAM_ABANDONED`](/reference/solid-js/diagnostics/ssr-stream-abandoned) | `ssr` | `warn` | Response stream cancelled or sink failed with fragments pending (observe + dev) | -| [`SSR_SUBTREE_ABANDONED`](/reference/solid-js/diagnostics/ssr-subtree-abandoned) | `ssr` | `warn` | A failed fragment's pending descendants were discarded (observe + dev) | -| [`SSR_UNDECLARED_LIVE_SOURCE`](/reference/solid-js/diagnostics/ssr-undeclared-live-source) | `ssr` | `warn` | A document render is still pumping an async iterable in server-component scope 5s in — declare the function `live(...)` or bound the source (dev) | -| [`STACKED_HOLDS`](/reference/solid-js/diagnostics/stacked-holds) | `responsiveness` | `warn` | 3+ interactions were waiting in one hold when it committed — repeats piled behind the same source (attribution enabled) | -| [`STORE_WRITE_OUTSIDE_SETTER`](/reference/solid-js/diagnostics/store-write-outside-setter) | `write` | `warn` | Store proxy written, deleted from, or defined on outside its setter; the write is ignored (once per store object and key) | -| [`STRICT_READ_UNTRACKED`](/reference/solid-js/diagnostics/strict-read-untracked) | `strict-read` | `warn` | Untracked reactive read in component/effect body | -| [`SYNC_NODE_RECEIVED_ASYNC`](/reference/solid-js/diagnostics/sync-node-received-async) | `lifecycle` | `error` | `sync: true` computation returned a Promise / AsyncIterable | -| [`UNCOMMITTED_INPUT_OVERWRITTEN`](/reference/solid-js/diagnostics/uncommitted-input-overwritten) | `render` | `warn` | A stateful property binding (`value`/`checked`/…) re-wrote an unchanged value over an edit the user never committed to the signal (dev; client) | -| [`UNRECOGNIZED_INSERT_VALUE`](/reference/solid-js/diagnostics/unrecognized-insert-value) | `render` | `warn` | Value at an insert position the renderer cannot render; skipped (dev; server and client) | -| [`UNSCOPED_HOLE_ALLOCATED_IDS`](/reference/solid-js/diagnostics/unscoped-hole-allocated-ids) | `render` | `warn` | Unscoped hole was handed a function whose content took ids at a position the other side does not share; keys permute (dev) | -| [`UNSTABLE_LIST_IDENTITY`](/reference/solid-js/diagnostics/unstable-list-identity) | `perf` | `warn` | `mapArray`/`For` recreated rows for equivalent items (attribution enabled) | -| [`UNSTABLE_MEMO_OUTPUT`](/reference/solid-js/diagnostics/unstable-memo-output) | `perf` | `warn` | Memo returned a new-but-equivalent container 4+ runs running (attribution enabled) | -| [`UNTRACKED_ASYNC_HANDLER`](/reference/solid-js/diagnostics/untracked-async-handler) | `responsiveness` | `info`, `warn` | Handler awaited 100ms+/200ms+ past its frame with no write before the `await` and no `action()`: a dead click no hold could judge (attribution enabled) | -| [`UNTRACKED_READ_AFTER_AWAIT`](/reference/solid-js/diagnostics/untracked-read-after-await) | `async` | `warn` | Async computation first read a signal/memo/store key after an `await`; never a dependency (dev; V8 engines only) | -| [`WASTED_RECOMPUTE`](/reference/solid-js/diagnostics/wasted-recompute) | `perf` | `warn` | 80%+ of a scope's 5+ runs in a second produced an unchanged value for 2ms+ of compute — inputs change, result does not (attribution enabled) | -| [`WIDE_SCOPE_DEPS`](/reference/solid-js/diagnostics/wide-scope-deps) | `perf` | `warn` | Scope subscribed to 200+ sources (attribution cost checks on) | +| Code | Kind | Severity | Trigger | +| ------------------------------------------------------------------------------------------------------ | ---------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [`ABANDONED_FLIGHTS`](/reference/solid-js/diagnostics/abandoned-flights) | `responsiveness` | `warn` | One async source abandoned 3+ flights in 1s, each superseded before landing — the request-per-keystroke signature (attribution enabled) | +| [`ACTION_CALLED_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/action-called-in-owned-scope) | `write` | `error` | `action()` invoked from a component body or computation | +| [`ASYNC_MEMO_ELEMENT`](/reference/solid-js/diagnostics/async-memo-element) | `ssr` | `error` | An async memo landed on rendered output (JSX, a boundary), which cannot serialize for hydration; the memo rejects (observe + dev; rejects in every tier) | +| [`ASYNC_OUTSIDE_LOADING_BOUNDARY`](/reference/solid-js/diagnostics/async-outside-loading-boundary) | `async` | `warn` | Async computation outside Loading boundary (non-halting; root mount is deferred) | +| [`ASYNC_STORE_SETTER`](/reference/solid-js/diagnostics/async-store-setter) | `write` | `error` | Store setter callback returned a Promise (setters are synchronous transactions) | +| [`ASYNC_WATERFALL`](/reference/solid-js/diagnostics/async-waterfall) | `perf` | `info`, `warn` | 2+/3+ sequential async flights, origin-proven (attribution enabled) | +| [`CAUGHT_REACTIVE_READ`](/reference/solid-js/diagnostics/caught-reactive-read) | `async` | `warn` | A computation caught a reactive read's throw (not ready, or the source's error) and completed with a value: the load is masked or the error hidden; once per node | +| [`CLEANUP_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/cleanup-in-forbidden-scope) | `lifecycle` | `error` | `onCleanup` inside trackedEffect/onSettled or a ref callback | +| [`DYNAMIC_ASYNC_COMPONENT`](/reference/solid-js/diagnostics/dynamic-async-component) | `ssr` | `error` | An async `dynamic()` source landed on a client component function, which cannot serialize for adoption; the memo rejects (observe + dev; rejects in every tier) | +| [`EFFECT_RELAY_TEAR`](/reference/solid-js/diagnostics/effect-relay-tear) | `perf` | `info`, `warn` | Reader ran twice for one root change because an effect relayed it; `warn` when derivable or repeated (attribution enabled) | +| [`EFFECT_WRITES_OWN_SOURCE`](/reference/solid-js/diagnostics/effect-writes-own-source) | `perf` | `info`, `warn` | Effect's write provably feeds back into its own inputs; `info` for multi-effect rings (attribution enabled) | +| [`FALLBACK_FLASH`](/reference/solid-js/diagnostics/fallback-flash) | `responsiveness` | `info` | A `Loading` fallback showed for under 150ms — feedback for a wait too short to need it (attribution enabled) | +| [`FLUSH_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/flush-in-effect-callback) | `lifecycle` | `warn` | `flush()` from an effect callback (no-op; the drain is already running) | +| [`FRAME_MARKER_CORRUPTED`](/reference/solid-js/diagnostics/frame-marker-corrupted) | `ssr` | `error` | Frame slot range missing its end marker on the client — nesting or an HTML rewriter (observe + dev) | +| [`GRAPH_GROWTH`](/reference/solid-js/diagnostics/graph-growth) | `perf` | `warn` | The live graph and what outlived each navigation climbed at a route's settle on 3 visits to 1.25× — something each visit leaves behind (attribution enabled) | +| [`HEAD_TAG_INVALID`](/reference/solid-js/diagnostics/head-tag-invalid) | `head` | `warn` | `useHead` registration the render could not honor; `data.reason` names the rule (dev) | +| [`HOT_SCOPE_FANOUT`](/reference/solid-js/diagnostics/hot-scope-fanout) | `perf` | `warn` | 5+/50+/500+ scopes hot from one root cause (attribution enabled) | +| [`HOT_SCOPE_RERUNS`](/reference/solid-js/diagnostics/hot-scope-reruns) | `perf` | `warn` | 120+ re-runs of one scope in 1s (attribution enabled) | +| [`HOT_SCOPE_TIME`](/reference/solid-js/diagnostics/hot-scope-time) | `perf` | `warn` | 8ms+ self-time in one scope in 1s (attribution enabled) | +| [`HUGE_FAN_IN`](/reference/solid-js/diagnostics/huge-fan-in) | `graph` | `warn` | One recompute tracked 2000 sources (always on) | +| [`HUGE_FAN_OUT`](/reference/solid-js/diagnostics/huge-fan-out) | `graph` | `warn` | One change reached 2000 live subscribers (always on), or 250 — `fanOut` — on a stamped root write (attribution enabled) | +| [`IMMUTABLE_UPDATE_IN_STORE`](/reference/solid-js/diagnostics/immutable-update-in-store) | `perf` | `warn` | Store container replaced by a mostly-identical copy (attribution enabled) | +| [`INVALID_AFFECTS_TARGET`](/reference/solid-js/diagnostics/invalid-affects-target) | `write` | `error` | `affects()` given a key path, or a key on an accessor | +| [`INVALID_HTML_NESTING`](/reference/solid-js/diagnostics/invalid-html-nesting) | `render` | `warn` | A hydrating insert claimed an element the HTML parser moved out of its parent (invalid nesting across a component boundary: `
` in `

`, `` in ``, `` in ``) (dev; client) | +| [`INVALID_REFRESH_TARGET`](/reference/solid-js/diagnostics/invalid-refresh-target) | `write` | `error` | `refresh()` target is not a source accessor or refreshable store | +| [`INVARIANT_VIOLATION`](/reference/solid-js/diagnostics/invariant-violation) | `error` | `error` | Internal consistency check failed (throws under `__TEST__`, reported in dev) | +| [`LATE_HEADER_WRITE`](/reference/solid-js/diagnostics/late-header-write) | `head` | `error` | Response header written after the head was sent; dropped (observe + dev; dev throws) | +| [`LAZY_ASSET_UNMAPPED`](/reference/solid-js/diagnostics/lazy-asset-unmapped) | `ssr` | `warn` | `lazy()` component's client assets could not be resolved for the page (dev) | +| [`LOADING_ON_ACCESSOR`](/reference/solid-js/diagnostics/loading-on-accessor) | `async` | `warn` | `` received a function (an accessor) instead of the dependency's value; it is never called, so the boundary never re-arms | +| [`LOADING_ON_OUTSIDE_HOLD`](/reference/solid-js/diagnostics/loading-on-outside-hold) | `async` | `warn` | `` changed but its data is also read outside the boundary and holds the frame: the fallback can never be seen | +| [`LONG_HOLD`](/reference/solid-js/diagnostics/long-hold) | `responsiveness` | `info`, `warn` | Acknowledged hold whose tail (last input → commit) ran 500ms+/1000ms+ (attribution enabled) | +| [`LOWERCASE_EVENT_ATTRIBUTE`](/reference/solid-js/diagnostics/lowercase-event-attribute) | `render` | `warn` | A function was set on a lowercase `on*` (or `on:`) attribute, which is not an event handler in 2.0; use `onXxx` (dev; client) | +| [`MISSING_EFFECT_FN`](/reference/solid-js/diagnostics/missing-effect-fn) | `lifecycle` | `error` | `createEffect` called without the effect function | +| [`NO_OWNER_BOUNDARY`](/reference/solid-js/diagnostics/no-owner-boundary) | `lifecycle` | `warn` | Boundary created without owner | +| [`NO_OWNER_CLEANUP`](/reference/solid-js/diagnostics/no-owner-cleanup) | `lifecycle` | `warn` | `onCleanup` called without owner | +| [`NO_OWNER_EFFECT`](/reference/solid-js/diagnostics/no-owner-effect) | `lifecycle` | `warn` | Effect created without reactive owner | +| [`ON_FLUSH_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/on-flush-in-owned-scope) | `lifecycle` | `warn` | `onFlush` called in a component body or computation (meant for event handlers and effect callbacks) | +| [`OPTIMISTIC_REVERTED`](/reference/solid-js/diagnostics/optimistic-reverted) | `responsiveness` | `info` | An optimistic value the screen showed was replaced by a different one — reverted at settle, or superseded by the truth (attribution enabled) | +| [`OPTIMISTIC_WRITE_BEFORE_LOAD`](/reference/solid-js/diagnostics/optimistic-write-before-load) | `write` | `error` | Optimistic write to a source whose first answer has not landed; no guess is made | +| [`OPTIMISTIC_WRITE_WHILE_LOADING`](/reference/solid-js/diagnostics/optimistic-write-while-loading) | `write` | `warn` | Optimistic write to a source that answered before and is loading a new question; the new answer replaces the guess (once per source) | +| [`PENDING_ASYNC_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/pending-async-forbidden-scope) | `async` | `warn` | Pending async read in trackedEffect/onSettled | +| [`PENDING_ASYNC_UNTRACKED_READ`](/reference/solid-js/diagnostics/pending-async-untracked-read) | `async` | `error` | Reading pending async outside tracking scope | +| [`PRELOAD_DESCRIPTOR_INVALID`](/reference/solid-js/diagnostics/preload-descriptor-invalid) | `head` | `warn` | `registerAsset("preload")` descriptor broke a field rule; link dropped or field ignored (dev) | +| [`PRIMITIVE_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/primitive-in-effect-callback) | `lifecycle` | `error` | Memo, effect, or root created inside an effect callback, its cleanup, or a ref callback (throws) | +| [`PRIMITIVE_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/primitive-in-forbidden-scope) | `lifecycle` | `error` | Reactive primitive created inside trackedEffect/onSettled | +| [`REACTIVE_WRITE_IN_OWNED_SCOPE`](/reference/solid-js/diagnostics/reactive-write-in-owned-scope) | `write` | `error` | Reactive write/invalidation inside component/computation | +| [`REACTIVITY_HALTED`](/reference/solid-js/diagnostics/reactivity-halted) | `error` | `error` | Uncaught error escaped every boundary; scheduling stopped (reported, cause to `reportError`) | +| [`REVEAL_IN_RENDER_TO_STRING`](/reference/solid-js/diagnostics/reveal-in-render-to-string) | `ssr` | `warn` | Nested `` with collapsed/together under `renderToString` (dev) | +| [`RUN_WITH_DISPOSED_OWNER`](/reference/solid-js/diagnostics/run-with-disposed-owner) | `owner` | `warn` | `runWithOwner` with disposed owner | +| [`SERVER_ERROR_SANITIZED`](/reference/solid-js/diagnostics/server-error-sanitized) | `ssr` | `error`, `info` | Error replaced with the generic Error on the wire — `data.source` `"server-function"` (`error`) or `"ssr"` (`info`); `data.error` is the original (observe + dev) | +| [`SERVER_WRITE`](/reference/solid-js/diagnostics/server-write) | `write` | `warn` | Signal/store/optimistic setter ran during a server render; inert, will throw (dev; once per category) | +| [`SETTLE_WALK_UNINITIALIZED_SOURCE`](/reference/solid-js/diagnostics/settle-walk-uninitialized-source) | `lifecycle` | `error` | Internal: settle walk reached a source that never produced a value (reported) | +| [`SETTLED_CLEANUP_UNOWNED`](/reference/solid-js/diagnostics/settled-cleanup-unowned) | `lifecycle` | `error` | `onSettled` returned a cleanup in an unowned (out-of-band) scope | +| [`SILENT_HOLD`](/reference/solid-js/diagnostics/silent-hold) | `responsiveness` | `info`, `warn` | Write held 100ms+/200ms+ by pending async with no on-screen acknowledgement (attribution enabled) | +| [`SSR_BOUNDARY_WATERFALL`](/reference/solid-js/diagnostics/ssr-boundary-waterfall) | `ssr` | `info`, `warn` | A `` boundary needed 3+/4+ render passes — 2+/3+ sequential async waits (dev) | +| [`SSR_CLIENT_CONTENT_MASKED`](/reference/solid-js/diagnostics/ssr-client-content-masked) | `ssr` | `warn` | Client-only content in a `` surfaced only after a server wait; the server's work was discarded (dev) | +| [`SSR_LIVE_HOLE_LATCHED`](/reference/solid-js/diagnostics/ssr-live-hole-latched) | `ssr` | `warn` | A live hole that shipped its markers was closed by the impurity gate on re-run and stopped updating (dev) | +| [`SSR_RENDER_ERROR_CONTAINED`](/reference/solid-js/diagnostics/ssr-render-error-contained) | `ssr` | `error` | Server render error routed by a boundary: `data.handling` fallback / client / failed (observe + dev) | +| [`SSR_STREAM_ABANDONED`](/reference/solid-js/diagnostics/ssr-stream-abandoned) | `ssr` | `warn` | Response stream cancelled or sink failed with fragments pending (observe + dev) | +| [`SSR_SUBTREE_ABANDONED`](/reference/solid-js/diagnostics/ssr-subtree-abandoned) | `ssr` | `warn` | A failed fragment's pending descendants were discarded (observe + dev) | +| [`SSR_UNDECLARED_LIVE_SOURCE`](/reference/solid-js/diagnostics/ssr-undeclared-live-source) | `ssr` | `warn` | A document render is still pumping an async iterable in server-component scope 5s in — declare the function `live(...)` or bound the source (dev) | +| [`STACKED_HOLDS`](/reference/solid-js/diagnostics/stacked-holds) | `responsiveness` | `warn` | 3+ interactions were waiting in one hold when it committed — repeats piled behind the same source (attribution enabled) | +| [`STORE_WRITE_OUTSIDE_SETTER`](/reference/solid-js/diagnostics/store-write-outside-setter) | `write` | `warn` | Store proxy written, deleted from, or defined on outside its setter; the write is ignored (once per store object and key) | +| [`STORE_WRITE_THROUGH_LOADING`](/reference/solid-js/diagnostics/store-write-through-loading) | `write` | `warn` | Store setter wrote inside another store still loading its first answer; the nested write is dropped | +| [`STRICT_READ_UNTRACKED`](/reference/solid-js/diagnostics/strict-read-untracked) | `strict-read` | `warn` | Untracked reactive read in component/effect body | +| [`SYNC_NODE_RECEIVED_ASYNC`](/reference/solid-js/diagnostics/sync-node-received-async) | `lifecycle` | `error` | `sync: true` computation returned a Promise / AsyncIterable | +| [`UNCOMMITTED_INPUT_OVERWRITTEN`](/reference/solid-js/diagnostics/uncommitted-input-overwritten) | `render` | `warn` | A stateful property binding (`value`/`checked`/…) re-wrote an unchanged value over an edit the user never committed to the signal (dev; client) | +| [`UNRECOGNIZED_INSERT_VALUE`](/reference/solid-js/diagnostics/unrecognized-insert-value) | `render` | `warn` | Value at an insert position the renderer cannot render; skipped (dev; server and client) | +| [`UNSCOPED_HOLE_ALLOCATED_IDS`](/reference/solid-js/diagnostics/unscoped-hole-allocated-ids) | `render` | `warn` | Unscoped hole was handed a function whose content took ids at a position the other side does not share; keys permute (dev) | +| [`UNSTABLE_LIST_IDENTITY`](/reference/solid-js/diagnostics/unstable-list-identity) | `perf` | `warn` | `mapArray`/`For` recreated rows for equivalent items (attribution enabled) | +| [`UNSTABLE_MEMO_OUTPUT`](/reference/solid-js/diagnostics/unstable-memo-output) | `perf` | `warn` | Memo returned a new-but-equivalent container 4+ runs running (attribution enabled) | +| [`UNTRACKED_ASYNC_HANDLER`](/reference/solid-js/diagnostics/untracked-async-handler) | `responsiveness` | `info`, `warn` | Handler awaited 100ms+/200ms+ past its frame with no write before the `await` and no `action()`: a dead click no hold could judge (attribution enabled) | +| [`UNTRACKED_READ_AFTER_AWAIT`](/reference/solid-js/diagnostics/untracked-read-after-await) | `async` | `warn` | Async computation first read a signal/memo/store key after an `await`; never a dependency (dev; V8 engines only) | +| [`WASTED_RECOMPUTE`](/reference/solid-js/diagnostics/wasted-recompute) | `perf` | `warn` | 80%+ of a scope's 5+ runs in a second produced an unchanged value for 2ms+ of compute — inputs change, result does not (attribution enabled) | +| [`WIDE_SCOPE_DEPS`](/reference/solid-js/diagnostics/wide-scope-deps) | `perf` | `warn` | Scope subscribed to 200+ sources (attribution cost checks on) | diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/caught-reactive-read.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/caught-reactive-read.mdx new file mode 100644 index 0000000000..e207d5adcf --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/caught-reactive-read.mdx @@ -0,0 +1,54 @@ +--- +title: "CAUGHT_REACTIVE_READ" +category: "Diagnostics" +use_cases: "caught_reactive_read diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "async" + - "warn" + - "reference" + - "v2" +version: "2.0" +description: "CAUGHT_REACTIVE_READ: A computation caught a reactive read's throw (not ready, or the source's error) and completed with a value: the load is masked or the error hidden; once per node." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" +--- + +{/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} + +A computation caught a reactive read's throw (not ready, or the source's error) and completed with a value: the load is masked or the error hidden; once per node. + +## What you saw + +- **Kind:** `async` +- **Severity:** `warn` (code that works but is structurally wrong or expensive) + +The console report opens with `[CAUGHT_REACTIVE_READ]` and the message, then an `in` line naming the owners that enclose the subject, root first, and an `at` line with the source location when the code was compiled with one. +In a captured artifact the same finding is an event with `code: "CAUGHT_REACTIVE_READ"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +A computation wrapped a reactive read in `try/catch` as it would an `await`, the read threw (not ready, or the source's error), the catch swallowed it, and the computation completed with a substitute value. +The throw was addressed to the graph: `NotReadyError` is how the read suspends to the nearest `` boundary or holds the change, and an error is how it reaches `` or `createEffect`'s error arm — the catch masks the first load, hides the error, and on the server the substitute is the answer. +It is also unreliable: when the source goes pending or errored later, this computation is marked with that status and not re-run, so the catch will not fire again. + +## How to fix it + +Remove the `try/catch`. +Branch on readiness with `isPending(source)`, show the last value ahead of the landing with `latest(() => …)`, or let the read suspend to a `` boundary; handle errors with `` or `createEffect`'s `error` option. +An interop layer that must catch should re-throw `NotReadyError` (`catch (e) { if (e instanceof NotReadyError) throw e; … }`), which does not warn. +An `async` computation is judged when its promise settles: a read before the first `await` that throws becomes the rejection (the throw continuing, no warning); a value landing after such a throw is the catch. +Reported once per computation, on the pass where the catch ran; a catch the status propagation bypasses is not detected. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `CAUGHT_REACTIVE_READ` is among them, with the events as evidence; after the fix, the code is gone from `artifact.diagnostics`. +[Check for regressions in tests](/guides/debugging-reactivity#check-for-regressions-in-tests) shows the loop and the Vitest matcher form. + +## Learn more + +- [Diagnostics](/reference/solid-js/diagnostics): every code, with its kind, severity, and trigger. +- [Debugging reactivity](/guides/debugging-reactivity): how to read a report and what each group of codes points at. diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/cleanup-in-forbidden-scope.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/cleanup-in-forbidden-scope.mdx index aa7e024bc5..738784a4cc 100644 --- a/src/routes/reference/(1)solid-js/(8)diagnostics/cleanup-in-forbidden-scope.mdx +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/cleanup-in-forbidden-scope.mdx @@ -9,7 +9,7 @@ tags: - "reference" - "v2" version: "2.0" -description: "CLEANUP_IN_FORBIDDEN_SCOPE: `onCleanup` inside trackedEffect/onSettled." +description: "CLEANUP_IN_FORBIDDEN_SCOPE: `onCleanup` inside trackedEffect/onSettled or a ref callback." source_repo: "solidjs/solid" source_ref: "next" source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" @@ -17,7 +17,7 @@ source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" {/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} -`onCleanup` inside trackedEffect/onSettled. +`onCleanup` inside trackedEffect/onSettled or a ref callback. ## What you saw @@ -35,6 +35,7 @@ In a captured artifact the same finding is an event with `code: "CLEANUP_IN_FORB ## How to fix it Return a cleanup function from the callback instead. +Inside a ref callback it throws too: register the cleanup in the factory that returns the ref (the component body). ## In tests diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/invalid-html-nesting.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/invalid-html-nesting.mdx new file mode 100644 index 0000000000..1699d66c45 --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/invalid-html-nesting.mdx @@ -0,0 +1,61 @@ +--- +title: "INVALID_HTML_NESTING" +category: "Diagnostics" +use_cases: "invalid_html_nesting diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "render" + - "warn" + - "reference" + - "v2" +version: "2.0" +description: "INVALID_HTML_NESTING: A hydrating insert claimed an element the HTML parser moved out of its parent (invalid nesting across a component boundary: `
` in `

`, `` in ``, `

` in `
`) (dev; client)." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" +--- + +{/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} + +A hydrating insert claimed an element the HTML parser moved out of its parent (invalid nesting across a component boundary: `` in `
`) (dev; client). + +## What you saw + +- **Kind:** `render` +- **Severity:** `warn` (code that works but is structurally wrong or expensive) + +The console report opens with `[INVALID_HTML_NESTING]` and the message, then an `in` line naming the owners that enclose the subject, root first, and an `at` line with the source location when the code was compiled with one. +In a captured artifact the same finding is an event with `code: "INVALID_HTML_NESTING"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +Hydration claimed a server-rendered element that is not where the template put it: the nesting is invalid HTML, so the browser's parser rebuilt the tree. +A `` directly in a `
` gets a `` the parser adds. +The compiler rejects this inside one template, so it nearly always spans a component boundary (`

{props.children}

` given a `
`, a `` of row components inside `
`). +The page differs from a client render and the insert cannot update the moved node. +Warned once per parent, in dev only; the message names the parent, the child and where the parser put it. + +:::note[Server rendering] +The server runtime reports on the same channel, with the same `in › ` line. +Two groups. +**Findings** ([`SSR_RENDER_ERROR_CONTAINED`](/reference/solid-js/diagnostics/ssr-render-error-contained), [`SSR_SUBTREE_ABANDONED`](/reference/solid-js/diagnostics/ssr-subtree-abandoned), [`SSR_STREAM_ABANDONED`](/reference/solid-js/diagnostics/ssr-stream-abandoned), [`LATE_HEADER_WRITE`](/reference/solid-js/diagnostics/late-header-write), [`DYNAMIC_ASYNC_COMPONENT`](/reference/solid-js/diagnostics/dynamic-async-component), [`ASYNC_MEMO_ELEMENT`](/reference/solid-js/diagnostics/async-memo-element), [`SERVER_ERROR_SANITIZED`](/reference/solid-js/diagnostics/server-error-sanitized), [`FRAME_MARKER_CORRUPTED`](/reference/solid-js/diagnostics/frame-marker-corrupted)) are facts about a render that exist in observe builds too — an APM sees them in production; in dev they print. +**Checks** (the rest, [`SSR_BOUNDARY_WATERFALL`](/reference/solid-js/diagnostics/ssr-boundary-waterfall) and [`SSR_CLIENT_CONTENT_MASKED`](/reference/solid-js/diagnostics/ssr-client-content-masked) included) are dev-only guidance. +A captured artifact from a server render carries both. +::: + +## How to fix it + +Fix: change the outer element (a `
{r => }
`. +A `

` inside a `` is dropped by the parser instead; the hydration key miss names it. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `INVALID_HTML_NESTING` is among them, with the events as evidence; after the fix, the code is gone from `artifact.diagnostics`. +[Check for regressions in tests](/guides/debugging-reactivity#check-for-regressions-in-tests) shows the loop and the Vitest matcher form. + +## Learn more + +- [Diagnostics](/reference/solid-js/diagnostics): every code, with its kind, severity, and trigger. +- [Debugging reactivity](/guides/debugging-reactivity): how to read a report and what each group of codes points at. diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-before-load.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-before-load.mdx new file mode 100644 index 0000000000..9e92d0b082 --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-before-load.mdx @@ -0,0 +1,50 @@ +--- +title: "OPTIMISTIC_WRITE_BEFORE_LOAD" +category: "Diagnostics" +use_cases: "optimistic_write_before_load diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "write" + - "error" + - "reference" + - "v2" +version: "2.0" +description: "OPTIMISTIC_WRITE_BEFORE_LOAD: Optimistic write to a source whose first answer has not landed; no guess is made." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" +--- + +{/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} + +Optimistic write to a source whose first answer has not landed; no guess is made. + +## What you saw + +- **Kind:** `write` +- **Severity:** `error` (broken behavior) + +The console report opens with `[OPTIMISTIC_WRITE_BEFORE_LOAD]` and the message, then an `in` line naming the owners that enclose the subject, root first, and an `at` line with the source location when the code was compiled with one. +In a captured artifact the same finding is an event with `code: "OPTIMISTIC_WRITE_BEFORE_LOAD"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +An optimistic setter ran before its source's first answer landed (`createOptimistic(async fn)`, or `createOptimisticStore(fn, seed)` whose derive has not landed — the seed does not count). +Before its first answer the source is loading: there is nothing on screen to be optimistic over (ruled 2026-11-03). +Dev throws and makes no guess (an action rejects). + +## How to fix it + +Repair: keep the pending items in a separate list (an outbox) until the source loads, or disable the action (the input) until the source has loaded. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `OPTIMISTIC_WRITE_BEFORE_LOAD` is among them, with the events as evidence; after the fix, the code is gone from `artifact.diagnostics`. +[Check for regressions in tests](/guides/debugging-reactivity#check-for-regressions-in-tests) shows the loop and the Vitest matcher form. + +## Learn more + +- [Diagnostics](/reference/solid-js/diagnostics): every code, with its kind, severity, and trigger. +- [Debugging reactivity](/guides/debugging-reactivity): how to read a report and what each group of codes points at. diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-while-loading.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-while-loading.mdx new file mode 100644 index 0000000000..2a7588aabb --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/optimistic-write-while-loading.mdx @@ -0,0 +1,51 @@ +--- +title: "OPTIMISTIC_WRITE_WHILE_LOADING" +category: "Diagnostics" +use_cases: "optimistic_write_while_loading diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "write" + - "warn" + - "reference" + - "v2" +version: "2.0" +description: "OPTIMISTIC_WRITE_WHILE_LOADING: Optimistic write to a source that answered before and is loading a new question; the new answer replaces the guess (once per source)." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" +--- + +{/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} + +Optimistic write to a source that answered before and is loading a new question; the new answer replaces the guess (once per source). + +## What you saw + +- **Kind:** `write` +- **Severity:** `warn` (code that works but is structurally wrong or expensive) + +The console report opens with `[OPTIMISTIC_WRITE_WHILE_LOADING]` and the message, then an `in` line naming the owners that enclose the subject, root first, and an `at` line with the source location when the code was compiled with one. +In a captured artifact the same finding is an event with `code: "OPTIMISTIC_WRITE_WHILE_LOADING"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +An optimistic setter ran while its source, which answered before, is loading a new question because an input changed: the setter composed on the previous answer, and the new answer replaces the guess (D-34, ruled 2026-11-12). +A `Loading on` re-arm shows a fallback, but the source still holds the old answer. +Not flagged before the first answer or during a `refresh()`. + +## How to fix it + +Repair: render the control inside the source's `Loading`, or disable it while the source is pending, or keep the pending change in a separate list until the new answer lands. +Once per source; a warning, the guess is still made. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `OPTIMISTIC_WRITE_WHILE_LOADING` is among them, with the events as evidence; after the fix, the code is gone from `artifact.diagnostics`. +[Check for regressions in tests](/guides/debugging-reactivity#check-for-regressions-in-tests) shows the loop and the Vitest matcher form. + +## Learn more + +- [Diagnostics](/reference/solid-js/diagnostics): every code, with its kind, severity, and trigger. +- [Debugging reactivity](/guides/debugging-reactivity): how to read a report and what each group of codes points at. diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/primitive-in-effect-callback.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/primitive-in-effect-callback.mdx index 8866eed633..f88dfaebfd 100644 --- a/src/routes/reference/(1)solid-js/(8)diagnostics/primitive-in-effect-callback.mdx +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/primitive-in-effect-callback.mdx @@ -9,7 +9,7 @@ tags: - "reference" - "v2" version: "2.0" -description: "PRIMITIVE_IN_EFFECT_CALLBACK: Memo, effect, or root created inside an effect callback or its cleanup, where there is no ambient owner (throws)." +description: "PRIMITIVE_IN_EFFECT_CALLBACK: Memo, effect, or root created inside an effect callback, its cleanup, or a ref callback (throws)." source_repo: "solidjs/solid" source_ref: "next" source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" @@ -17,7 +17,7 @@ source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" {/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} -Memo, effect, or root created inside an effect callback or its cleanup, where there is no ambient owner (throws). +Memo, effect, or root created inside an effect callback, its cleanup, or a ref callback (throws). ## What you saw @@ -36,6 +36,7 @@ The effect phase has no ambient owner, so those computations cannot be disposed ## How to fix it Create them in the compute phase, or attach them to an existing owner with `runWithOwner`. +A ref callback runs like a render effect's callback and owns nothing, so creating one there throws too: create it in the factory that returns the ref. Creating a signal alone does not trigger this error. ## In tests diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/store-write-through-loading.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/store-write-through-loading.mdx new file mode 100644 index 0000000000..f0de40b405 --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/store-write-through-loading.mdx @@ -0,0 +1,51 @@ +--- +title: "STORE_WRITE_THROUGH_LOADING" +category: "Diagnostics" +use_cases: "store_write_through_loading diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "write" + - "warn" + - "reference" + - "v2" +version: "2.0" +description: "STORE_WRITE_THROUGH_LOADING: Store setter wrote inside another store still loading its first answer; the nested write is dropped." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/solid/skills/reactivity-diagnostics/SKILL.md" +--- + +{/* Generated by scripts/extract-diagnostics.mjs from packages/solid/skills/reactivity-diagnostics/SKILL.md and packages/solid/diagnostics.json in solidjs/solid. Edit the skill, then regenerate. */} + +Store setter wrote inside another store still loading its first answer; the nested write is dropped. + +## What you saw + +- **Kind:** `write` +- **Severity:** `warn` (code that works but is structurally wrong or expensive) + +The console report opens with `[STORE_WRITE_THROUGH_LOADING]` and the message, then an `in` line naming the owners that enclose the subject, root first, and an `at` line with the source location when the code was compiled with one. +In a captured artifact the same finding is an event with `code: "STORE_WRITE_THROUGH_LOADING"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +A store setter wrote inside a value that is another store still loading its first answer (`setOuter(s => { s.child.x = 9 })`, where `outer`'s derive returned `{ child: inner }`). +The nested write needs that store's contents and they do not exist yet (its seed is never shown), so the write is dropped, as a write to a loading store is replaced by its first answer; the outer store keeps following the inner one. + +## How to fix it + +Repair: write after the inner store loads, or replace the whole value, `setOuter(s => { s.child = { ...next } })`. +`data.property` names the key holding the loading store. +Production drops the write the same way, without the warning. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `STORE_WRITE_THROUGH_LOADING` is among them, with the events as evidence; after the fix, the code is gone from `artifact.diagnostics`. +[Check for regressions in tests](/guides/debugging-reactivity#check-for-regressions-in-tests) shows the loop and the Vitest matcher form. + +## Learn more + +- [Diagnostics](/reference/solid-js/diagnostics): every code, with its kind, severity, and trigger. +- [Debugging reactivity](/guides/debugging-reactivity): how to read a report and what each group of codes points at. diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/strict-read-untracked.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/strict-read-untracked.mdx index 8cf917c2bb..9d5a7cff86 100644 --- a/src/routes/reference/(1)solid-js/(8)diagnostics/strict-read-untracked.mdx +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/strict-read-untracked.mdx @@ -38,6 +38,9 @@ The read got the current value once and will never update. Move the read into a tracking scope: JSX, a memo, or an effect's compute function. If you intentionally want a one-time snapshot, wrap the read in `untrack()` to say so explicitly. +When the context is "an event handler expression", the read is in the expression an element's handler is bound from (`onClick={selected() ? a : b}`, `onClick={makeHandler(id())}`, or a component prop forwarded to an element that the parent passed a reactive expression). +Handlers are bound once and are not reactive: move the read inside the handler function (`onClick={() => (selected() ? a() : b())}`), and pass plain functions down as handler props. + ## In tests `captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. diff --git a/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-stream.mdx b/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-stream.mdx index a8f09872dc..067f202358 100644 --- a/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-stream.mdx +++ b/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-stream.mdx @@ -48,6 +48,13 @@ function renderToStream( noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; + /** + * Server modulepreload hints for modules outside the entry's static import + * closure (lazy and route chunks) carry `fetchpriority="low"` so they do not + * compete with the modules hydration waits on. `false` emits them at default + * priority. + */ + lowPriorityPreloads?: boolean; onCompleteShell?: (info: { write: (v: string) => void }) => void; onCompleteAll?: (info: { write: (v: string) => void }) => void; /** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */ @@ -69,6 +76,12 @@ function renderToStream( * "signal"`); the one teardown handle for a host whose transport cannot * report a dead consumer through the sink or the readable view — pass * `request.signal`. + * Awaiting the render rejects with `signal.reason` when this signal aborts; + * the streaming forms stop writing and end cleanly — a close, not an + * error, since bytes are already out: `pipe` ends its sink, `pipeTo` + * closes its writable (after the writes already handed to it) and + * resolves, and `readable` closes. `onError` and `onCompleteAll` are not + * called (#4646). */ signal?: AbortSignal; } @@ -77,7 +90,7 @@ function renderToStream( * Awaiting the stream resolves with the complete HTML once every boundary * settles — the fully-settled-string form of the render. Render errors * route through `onError` and the promise resolves with whatever HTML the - * render produced; it never rejects. + * render produced. Signal cancellation rejects with `signal.reason`. */ then( onfulfilled?: ((html: string) => TResult1 | PromiseLike) | null, @@ -99,7 +112,7 @@ Function that returns the root JSX. ### `options` -- **Type:** `{ nonce?: CSPNonce; renderId?: string; noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; onCompleteShell?: (info: { write: (v: string) => void }) => void; onCompleteAll?: (info: { write: (v: string) => void }) => void; onError?: ServerErrorHook; onHead?: (head: string) => void; signal?: AbortSignal; }` +- **Type:** `{ nonce?: CSPNonce; renderId?: string; noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; lowPriorityPreloads?: boolean; onCompleteShell?: (info: { write: (v: string) => void }) => void; onCompleteAll?: (info: { write: (v: string) => void }) => void; onError?: ServerErrorHook; onHead?: (head: string) => void; signal?: AbortSignal; }` - Optional The `renderToString` options plus `onCompleteShell` and `onCompleteAll` hooks. diff --git a/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-string.mdx b/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-string.mdx index fe0744a04d..f88c95ab2e 100644 --- a/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-string.mdx +++ b/src/routes/reference/(2)solid-web/(1)rendering-ssr/render-to-string.mdx @@ -43,6 +43,13 @@ function renderToString( noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; + /** + * Server modulepreload hints for modules outside the entry's static import + * closure (lazy and route chunks) carry `fetchpriority="low"` so they do not + * compete with the modules hydration waits on. `false` emits them at default + * priority. + */ + lowPriorityPreloads?: boolean; /** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */ onError?: ServerErrorHook; /** @@ -70,7 +77,7 @@ Function that returns the root JSX. ### `options` -- **Type:** `{ nonce?: CSPNonce; renderId?: string; noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; onError?: ServerErrorHook; onHead?: (head: string) => void; }` +- **Type:** `{ nonce?: CSPNonce; renderId?: string; noScripts?: boolean; plugins?: any[]; manifest?: AssetManifest | AssetResolver | AssetResolverFn; lowPriorityPreloads?: boolean; onError?: ServerErrorHook; onHead?: (head: string) => void; }` - Optional `nonce` for CSP, `renderId` for hydration id prefixes, `noScripts` to omit the hydration script, `manifest` for asset resolution, `onError`, and `onHead` for hosts that own the document. diff --git a/src/routes/reference/(2)solid-web/(1)rendering-ssr/set-trusted-types-policy.mdx b/src/routes/reference/(2)solid-web/(1)rendering-ssr/set-trusted-types-policy.mdx new file mode 100644 index 0000000000..806efa6541 --- /dev/null +++ b/src/routes/reference/(2)solid-web/(1)rendering-ssr/set-trusted-types-policy.mdx @@ -0,0 +1,65 @@ +--- +title: "setTrustedTypesPolicy" +category: "Rendering & SSR" +use_cases: "rendering & ssr api, settrustedtypespolicy usage" +tags: + - "set" + - "trusted" + - "types" + - "policy" + - "rendering" + - "ssr" + - "reference" + - "api" + - "v2" +version: "2.0" +description: "Sets the Trusted Types policy that HTML is parsed through." +source_repo: "solidjs/solid" +source_ref: "next" +source_path: "packages/web/src/client.ts" +--- + +{/* Generated by scripts/extract-solid-ref.mjs. Edit the source JSDoc or disposition map, then regenerate. */} + +Sets the Trusted Types policy that HTML is parsed through. + +A page that enforces `require-trusted-types-for 'script'` rejects a plain +string assigned to `innerHTML`. With a policy set, the runtime assigns the +`TrustedHTML` that `policy.createHTML(html)` returns. It is asked for two +kinds of HTML: the static markup the compiler emitted for a template, and +the HTML a server component sends, which the frames client parses. The app +creates the policy, so its name and its checks stay under the app's +Content Security Policy: + +```ts +setTrustedTypesPolicy( + trustedTypes.createPolicy("my-app", { createHTML: (html) => html }) +); +``` + +Call it before the first render. `undefined` goes back to plain strings. + +## Import + +```ts +import { setTrustedTypesPolicy } from "@solidjs/web"; +``` + +## Type signature + +```ts +function setTrustedTypesPolicy( + policy: { createHTML(html: string): unknown } | undefined +): void; +``` + +## Parameters + +### `policy` + +- **Type:** `{ createHTML(html: string): unknown } | undefined` + +## Learn more + +- [Rendering and SSR](/concepts/rendering-and-ssr) +- [Choose a rendering mode](/guides/choose-a-rendering-mode) diff --git a/src/routes/reference/(2)solid-web/(3)components/portal.mdx b/src/routes/reference/(2)solid-web/(3)components/portal.mdx index 2e20bd503d..e44293c8d2 100644 --- a/src/routes/reference/(2)solid-web/(3)components/portal.mdx +++ b/src/routes/reference/(2)solid-web/(3)components/portal.mdx @@ -73,7 +73,7 @@ Content to render at the mount point. ## Common problems -- [An effect or `onCleanup` inside a `ref` callback never runs](/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-never-runs) +- [An effect or `onCleanup` inside a `ref` callback throws](/concepts/components-and-jsx#an-effect-or-oncleanup-inside-a-ref-callback-throws) ## Learn more diff --git a/src/routes/reference/(2)solid-web/(4)jsx-properties/(0)ref.mdx b/src/routes/reference/(2)solid-web/(4)jsx-properties/(0)ref.mdx index 12afcd8aa7..ebafd6f739 100644 --- a/src/routes/reference/(2)solid-web/(4)jsx-properties/(0)ref.mdx +++ b/src/routes/reference/(2)solid-web/(4)jsx-properties/(0)ref.mdx @@ -73,9 +73,11 @@ This composes element access, reusable directives, and third-party integrations ## Ownership and cleanup -Ref callbacks run untracked and without a reactive owner. -Their return values are ignored. +A ref callback runs the way a render effect's callback runs when the element is created: untracked, in the context of the pass that creates the element, so its reads see what that pass is building. +It owns nothing, and its return value is ignored. Do not create owned reactive primitives or return cleanup functions from a ref callback. +In development, creating a memo, effect, or root inside one throws [`PRIMITIVE_IN_EFFECT_CALLBACK`](/reference/solid-js/diagnostics/primitive-in-effect-callback), and `onCleanup` throws [`CLEANUP_IN_FORBIDDEN_SCOPE`](/reference/solid-js/diagnostics/cleanup-in-forbidden-scope). +Writes, `refresh`, action calls, and `onFlush` are allowed, as in an effect callback. When a reusable directive needs setup and cleanup, create those primitives in an owned factory and return only the callback that receives the element. See [Refs and directives](/concepts/components-and-jsx#refs-and-directives) for the complete pattern, and [Integrate non-Solid code](/guides/integrate-non-solid-code) for a chart, a map, and a web component driven through refs.