EFFECT_RELAY_TEAR
Reader ran twice for one root change because an effect relayed it; warn when derivable or repeated (attribution enabled).
What you saw
- Kind:
perf - Severity:
info(advisory, delivered on the diagnostics channel and never printed) orwarn(code that works but is structurally wrong or expensive)
The console report opens with [EFFECT_RELAY_TEAR] 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: "EFFECT_RELAY_TEAR", ownerPath, and loc.
Diagnostics explains each line.
Why it fires
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:
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
aitself" (data.passthrough) — the prop-to-state port. Repair: readawhereSwas 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. - "
Shas other writers — editable state reset from a source" (copytrue,soleWriterfalse;infountil it repeats) — the controlled-input shape. If resetting local editable state when the source changes is the intent, the tear is its cost; ifSonly ever mirrors the source, drop the copy. - Neither (
infountil 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.
In tests
captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw.
expectNoDiagnostics(artifact) fails while EFFECT_RELAY_TEAR 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.