diff --git a/scripts/extract-diagnostics.mjs b/scripts/extract-diagnostics.mjs index 489046a6b..bdc0e33dd 100644 --- a/scripts/extract-diagnostics.mjs +++ b/scripts/extract-diagnostics.mjs @@ -76,6 +76,7 @@ const FIX_STARTS = { HEAD_TAG_INVALID: "`non-head-tag`/`invalid-attribute`: only head elements", HOT_SCOPE_RERUNS: "The message names the latest cause", LAZY_ASSET_UNMAPPED: "This is bundler-plugin configuration", + LOADING_ON_ACCESSOR: "`on` takes the dependency's value", PENDING_ASYNC_UNTRACKED_READ: "Async values must be read where tracking", RUN_WITH_DISPOSED_OWNER: "This usually means a stale owner", SSR_BOUNDARY_WATERFALL: "The same repairs apply, in the same order", 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 c7035c08f..732f6777b 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 @@ -75,6 +75,7 @@ Naming your memos and effects (`{ name }`) turns the trailing `effect` in the `i | [`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) | diff --git a/src/routes/reference/(1)solid-js/(8)diagnostics/loading-on-accessor.mdx b/src/routes/reference/(1)solid-js/(8)diagnostics/loading-on-accessor.mdx new file mode 100644 index 000000000..fd4b20bfb --- /dev/null +++ b/src/routes/reference/(1)solid-js/(8)diagnostics/loading-on-accessor.mdx @@ -0,0 +1,49 @@ +--- +title: "LOADING_ON_ACCESSOR" +category: "Diagnostics" +use_cases: "loading_on_accessor diagnostic, console warning repair, diagnostics assertion" +tags: + - "diagnostics" + - "async" + - "warn" + - "reference" + - "v2" +version: "2.0" +description: "LOADING_ON_ACCESSOR: `` received a function (an accessor) instead of the dependency's value; it is never called, so the boundary never re-arms." +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. */} + +`` received a function (an accessor) instead of the dependency's value; it is never called, so the boundary never re-arms. + +## What you saw + +- **Kind:** `async` +- **Severity:** `warn` (code that works but is structurally wrong or expensive) + +The console report opens with `[LOADING_ON_ACCESSOR]` 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: "LOADING_ON_ACCESSOR"`, `ownerPath`, and `loc`. +[Diagnostics](/reference/solid-js/diagnostics#read-a-report) explains each line. + +## Why it fires + +A Loading boundary's `on` received a function, such as `on={route}` or `on={() => route()}`. + +## How to fix it + +`on` takes the dependency's value, so pass `on={route()}`, or `on={[query(), page()]}` for several dependencies. +An accessor passed instead is never called, nothing is read, and the boundary never re-arms. + +## In tests + +`captureArtifact` from `@solidjs/diagnostics` runs a scenario with the diagnostics channel open and returns the events it saw. +`expectNoDiagnostics(artifact)` fails while `LOADING_ON_ACCESSOR` 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.