Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions scripts/extract-diagnostics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const STANDALONE_REWRITES = [
// error, so the map tracks the skill.
const FIX_STARTS = {
ACTION_CALLED_IN_OWNED_SCOPE: "Actions are imperative entry points",
BINDING_SLOT_POSITION: "The rule: a slot property is a JSX attribute value",
CLEANUP_IN_FORBIDDEN_SCOPE: "return a cleanup function from the callback",
EFFECT_WRITES_OWN_SOURCE:
"The written value is a function of what the effect reads",
Expand All @@ -79,7 +78,7 @@ const FIX_STARTS = {
LAZY_ASSET_UNMAPPED: "This is bundler-plugin configuration",
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",
SSR_BOUNDARY_WATERFALL: "The same repairs apply, in the same order",
SSR_RENDER_ERROR_CONTAINED: "In every case the repair is",
SSR_STREAM_ABANDONED: "At volume it is the cost",
UNRECOGNIZED_INSERT_VALUE: "Usually a component function inserted",
Expand Down
15 changes: 5 additions & 10 deletions src/routes/(5)guides/(14)testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,10 @@ The configuration above sets `globals: false`, so the explicit `afterEach(cleanu
Choose browser mode when jsdom cannot provide the behavior that the test needs.
The maintained browser-mode template uses the Playwright provider with headless Chromium.

:::note[Browser mode still needs jsdom installed]
When `test.environment` is unset, `@solidjs/vite-plugin` supplies a jsdom environment and Vitest resolves that dependency before it starts the browser pool.
Without jsdom, the Chromium test can pass while the Vitest command exits with a missing-dependency error.
:::

For a new test setup, install the complete dependency set:

```sh
pnpm add -D vitest jsdom @solidjs/testing-library @testing-library/jest-dom @vitest/browser-playwright playwright
pnpm add -D vitest @solidjs/testing-library @testing-library/jest-dom @vitest/browser-playwright playwright
pnpm exec playwright install chromium
```

Expand Down Expand Up @@ -380,11 +375,11 @@ The write is staged and the batch has not landed when the next line runs.
Call `flush()` after the event and before the assertion.
For an async source, `flush()` does not help; await `resolve(() => value())` or use an asynchronous query.

### The Chromium test passes but Vitest exits with a missing-dependency error
### A component test fails with `document is not defined`

jsdom is not installed.
`@solidjs/vite-plugin` supplies a jsdom environment when `test.environment` is unset, and Vitest resolves that dependency before starting the browser pool.
Keep `jsdom` in the development dependencies alongside the browser provider.
The `test` block does not set `environment`, so Vitest runs the file in Node.
`@solidjs/vite-plugin` does not choose a test environment.
Set `environment: "jsdom"` (or `"happy-dom"`) for component tests, or enable browser mode.

### A server test runs under jsdom

Expand Down
2 changes: 2 additions & 0 deletions src/routes/(6)migration/(0)from-solid-1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ Treat those imports as host-integration work and confirm them against the owning
## Update tests

Update test compilation to use the renderer's JSX runtime.
The Vite plugin no longer sets `test.environment`.
Set `environment: "jsdom"` (or `"happy-dom"`) in the Vitest configuration for component tests; without it, Vitest runs them in Node.
For web component tests, resolve the browser and development package conditions so tests exercise `@solidjs/web` rather than the server entry.
Keep Testing Library cleanup or call render disposers explicitly.

Expand Down
3 changes: 2 additions & 1 deletion src/routes/reference/(1)solid-js/(8)diagnostics/(0)index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Naming your memos and effects (`{ name }`) turns the trailing `effect` in the `i
| [`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) |
| [`BINDING_SLOT_POSITION`](/reference/solid-js/diagnostics/binding-slot-position) | `ssr`, `render` | `warn`, `error` | Binding-slot value where it cannot bind; `data.reason` names the position (spread is an error and throws), client reasons `orphan`/`fill-shape` |
| [`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) |
Expand Down Expand Up @@ -105,8 +104,10 @@ Naming your memos and effects (`{ name }`) turns the trailing `effect` in the `i
| [`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) |
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,23 @@ Derived state kept in sync by an effect: `createEffect(() => f(a()), v => setS(v
The message names a reader that ran twice for ONE write of `a` — once in the flush where `a` changed (against the stale `S`), once after the effect's write landed — so its first frame was inconsistent.
That double run is proven from the cause chain; the rest of the message is confidence:

- "The written value is the effect's compute output" — by Solid's contract the compute half is a pure function of its tracked reads, so the value is derivable. Repair: `const s = createMemo(() => f(a()))`, delete the effect and the signal. This form warns on its own once it has repeated (`data.copy: true`), even with no double-running reader — everything reading the copy paints a flush behind everything reading the source.
- "The written value is `a` itself" (`data.passthrough`) — the prop-to-state port. Repair: read `a` where `S` was read; a memo only if a stable derivation is genuinely needed.
- "Nothing else writes `S`" (`data.soleWriter`, `copy` false) — derived state if the value is computed from what the effect reads: same memo repair. If the effect measures (layout, `Date.now()`, a ref), the tear is the cost of measuring.
- "`S` has other writers — editable state reset from a source" (`copy` true, `soleWriter` false; `info` until it repeats) — the controlled-input shape. If resetting local editable state when the source changes is the intent, the tear is its cost; if `S` only ever mirrors the source, drop the copy.
- Neither — the written value is not the compute output and the signal has other writers. If the effect reads something outside the graph, the tear is the cost of measuring and the finding is a fact to accept; if the value is computed from what the effect reads, it is still a memo.

An effect whose apply half takes no argument (`createEffect(open, () => setFlipped(measure()))`) is reading something other than its compute output, so a matching write is never taken as a copy and its tears stay `info` however often they repeat: the cost of measuring.
One that takes the value (`v => setS(v)`, `v => setLabel(v ? "Close" : "Open")`) is judged as above and warns once it has repeated, a measurement included (`i => setLeft(offsets[i])` with stable layout): drop the parameter if the write does not use it.

:::note[Performance pathologies (from the attribution engine)]
These fire only while attribution is enabled and describe cost, not incorrect behavior.
The numbers in the message are measurements, not guesses.
:::

## How to fix it

- "The written value is the effect's compute output" — by Solid's contract the compute half is a pure function of its tracked reads, so the value is derivable. Repair: `const s = createMemo(() => f(a()))`, delete the effect and the signal. This form warns on its own once it has repeated (`data.copy: true`), even with no double-running reader — everything reading the copy paints a flush behind everything reading the source.
- "The written value is `a` itself" (`data.passthrough`) — the prop-to-state port. Repair: read `a` where `S` was read; a memo only if a stable derivation is genuinely needed.
- "Nothing else writes `S`" (`data.soleWriter`) — derived state without the identity proof; same memo repair.
- "`S` has other writers — editable state reset from a source" (`copy` true, `soleWriter` false; `info` until it repeats) — the controlled-input shape. If resetting local editable state when the source changes is the intent, the tear is its cost; if `S` only ever mirrors the source, drop the copy.
- Neither (`info` until it repeats) — the written value is not the compute output and the signal has other writers. If the effect reads something outside the graph (layout, `Date.now()`, a ref), the tear is the cost of measuring and the finding is a fact to accept; if the value is computed from what the effect reads, it is still a memo.
Do not defer the write to a microtask to quiet it; that only hides the cause chain.

## In tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In a captured artifact the same finding is an event with `code: "LOWERCASE_EVENT

## Why it fires

A function was set on an attribute whose name starts with `on` but is not an event handler (`data.name`): a lowercase `onclick`, or a leftover 1.x `on:click`.
A function was set on an attribute whose name starts with `on` but is not an event handler (`data.name`): a lowercase `onclick`, or a leftover 1.x `on:click` passed through a spread (on a native element it is a compile error).
In 2.0 only `on` + an uppercase letter binds an event; anything else is a plain attribute, so the function was stringified into it and never runs.
Once per attribute name.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ An earlier uncaught error halted the reactive system; subsequent updates are ign
## How to fix it

Do not treat this code as the bug — find the original error above it (or add an error boundary with `<Errored>`) and fix that.
The `in <App> › …` line under the message (repeated on the "Update ignored" notice) is the owner path of the computation the error escaped from: start there.

## In tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ In a captured artifact the same finding is an event with `code: "SETTLED_CLEANUP
## Why it fires

`onSettled` returned a cleanup while running in an unowned scope, so the cleanup cannot be honored.
Throws in dev; in production the cleanup is dropped.

## How to fix it

Expand Down
Loading
Loading