UNSTABLE_LIST_IDENTITY
mapArray/For recreated rows for equivalent items (attribution enabled).
What you saw
- Kind:
perf - Severity:
warn(code that works but is structurally wrong or expensive)
The console report opens with [UNSTABLE_LIST_IDENTITY] 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: "UNSTABLE_LIST_IDENTITY", ownerPath, and loc.
Diagnostics explains each line.
Why it fires
A mapArray/<For> update disposed and recreated most rows while the entering items were field-for-field equivalent to the ones they replaced: a re-fetch (or a spread-copy, see above) handed back fresh objects for the same records, and identity keying treated each as a new row — DOM, state, focus, and scroll position thrown away and rebuilt.
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
Repairs: key the list by a stable field (<For each={rows()} keyed={r => r.id}>), or merge the data into a store with reconcile(data, "id") so the same records keep the same identity.
If a key function is already in use (data.keyed: true) it is returning unstable keys (the object itself, or something that changes with the fetch) — return the stable field.
Once per list.
In tests
captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw.
expectNoDiagnostics(artifact) fails while UNSTABLE_LIST_IDENTITY is among them, with the events as evidence; after the fix, the code is gone from artifact.diagnostics.
expectRerunBudget(artifact, max, { scope }) bounds how often a named scope may re-run, and expectNoWaste(artifact) fails on re-runs whose result was unchanged.
Both read the attribution records, which captureArtifact collects unless attribution: false is passed.
Check for regressions in tests shows the loop and the Vitest matcher form.
Learn more
- Diagnostics: every code, with its kind, severity, and trigger.
- Debugging reactivity: how to read a report and what each group of codes points at.
- Attribution: the engine whose records explain a re-run, a hold, or a waterfall.