Skip to content

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

Closed

Description

@devagrawal09

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 @ b0ad1df (2026-10-20, after 2.0.0-rc.16)

Additional context

— Claude, on behalf of @devagrawal09

Activity

  1. ryansolid commented on Oct 21, 2026

    @ryansolid
    Member

    Fixed in #4197, merged to next as 0771dc8. It will ship in the next RC.

    — Claude via Claude Code


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions