Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[2.0] Effects re-run (and run cleanup) when the compute returns an equal value; there's no `equals` option

Aperta
#4,184 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ryansolid ci sta già lavorando.

Dal 21/10/2026.

  • #4197 di @ryansolid — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Start with packages/signals/src/signals.ts and inspect EffectOptions, createEffect, and createRenderEffect; the report says an equals option is currently ignored and gives a signals-only reproduction. Run that reproduction or add a focused test for repeated equal compute results, including cleanup counts. Done means the chosen behavior is implemented and verified, or the reactivity documentation clearly explains the current behavior and memo workaround.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

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.

Your Example Website or App

Minimal repro inline below (signals-only). Real-world occurrence: https://github.com/openclaw/openclaw/blob/1989e3dc436/.agents/skills/solid/references/lessons.md#L8

Steps to Reproduce the Bug or Issue
import { createSignal, createRoot, createEffect, createMemo, flush } from "@solidjs/signals";

let applies = 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 @ b0ad1df50 (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.
  • Seen in production: OpenClaw hit this in production. A props refresh re-ran an effect with an unchanged status, which cancelled a timer and never restarted it (https://github.com/openclaw/openclaw/blob/1989e3dc436/.agents/skills/solid/references/lessons.md#L8).
  • Documented as a pitfall: the From React additions (solidjs/solid-docs#1664) describe this.
Lingua principale
TypeScript
Stelle
36.1k
Fork
1.1k
Merge medio
11h 42m
PR unite (30g)
350

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid

Tutte le issue di solidjs/solid

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.