You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[2.0] Effects re-run (and run cleanup) when the compute returns an equal value; there's no equals option #4184
createEffect(compute, effectFn) and createRenderEffect re-run the effect function, and the previous cleanup, every time a tracked read changes, even when compute returns the same value as before. EffectOptions (packages/signals/src/signals.ts) has no equals, and passing one is silently ignored.
import{createSignal,createRoot,createEffect,createMemo,flush}from"@solidjs/signals";letapplies=0,cleanups=0;const[n,setN]=createSignal(1);createRoot(()=>createEffect(()=>n()>0,()=>{applies++;return()=>{cleanups++;};}));flush();setN(2);flush();setN(3);flush();// compute returned true three times
Setup
computes
applies
cleanups
Plain
3
3
2
createMemo(() => n() > 0) in front
1
0
{ equals: (a, b) => a === b } passed as options
3
(ignored)
createRenderEffect gives the same numbers.
Expected behavior
Either:
the effect skips its apply and cleanup when the compute result is equal (using the same default equals as memos, or an equals option on effects); or
the reactivity docs and cheatsheet state the current behavior clearly and recommend a memo in front. An unknown equals option could also warn in dev instead of being silently ignored.
Screenshots or Videos
No response
Platform
OS: macOS (Darwin 25.5)
Browser: n/a (reproduced in Node v24.18.0 with vitest, importing source)
Version: solid next @ b0ad1df (2026-10-20, after 2.0.0-rc.16)
Additional context
React developers assume the opposite:useEffect skips when its dependencies are unchanged.
Cleanups churn: because cleanups re-run, subscriptions and timers are torn down and restarted on unrelated changes.
Activity
docs: effects re-run on equal compute values; memo in front to skip (#…
ryansolid commentedon Oct 21, 2026
Generated by Claude Code