Skip to content

[2.0 rc.15] Reading lazy memo in both side of conditional expression causes infinite computation loop #4142

Closed

Description

@andjsrk

Describe the bug

Conditions:

  • The memo should be lazy.
  • The expression should be conditional. [memo().a, memo().b] works normally.
  • The memo should be read in both side(condition and conditionally evaluated value) of the expression.

Then the memo gets recomputed automatically when the compute function yielded a value, leading to infinite loading.

The document for createMemo says:

lazy — boolean
When true, defers the initial computation until the value is first read, and opts the memo into autodisposal — once it has no remaining subscribers it is torn down and recomputed from scratch on the next read.

My naive guess is that the memo gets disposed before the conditionally evaluated value subscribes the memo so recomputation occurs.

Your Example Website or App

https://solid2.netlify.app/#solidjs-repl:SRn7SNNPTRCRKF9GzAEvTg

Steps to Reproduce the Bug or Issue

  1. Open the playground.
  2. Check the checkbox to start computation.
  3. See console, messages keep logging.

Expected behavior

The memo should not be computed again unless either it is completely unused or any of its dependencies is changed.

Screenshots or Videos

v.mp4

Platform

  • OS: Windows
  • Browser: Chrome 155.0.8059.40
  • Solid: 2.0.0 rc.14 and rc.15

Additional context

It seems the problem exists since @solidjs/signals@2.0.0-rc.14.

Activity

  1. ryansolid commented on Oct 19, 2026

    @ryansolid
    Member

    Fixed by #4164, now merged to next. The playground from this issue fetches once and shows the user. The regression tests are lazy-memo-rebuilt-reader-4142.test.ts (signals) and lazy-memo-loading-loop-4142.spec.tsx (web). Closing.

    — 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