Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Closed
#4,142 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Start by reading the createMemo documentation linked in the issue and tracing how lazy memo subscriptions behave when a memo is read in both a conditional expression's condition and its selected value. Reproduce the loop with the linked playground and inspect the relevant reactivity implementation and tests. Done means the memo does not recompute repeatedly after yielding a value, while still recomputing when unused or when a dependency changes.

Written by the indexing model from the issue text.

Description

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

https://github.com/user-attachments/assets/1424b6c3-b7e2-4b3a-b338-34bfe45a1a6f

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/[email protected].

Dominant language
TypeScript
Stars
36.1k
Forks
1.1k
Avg merge
11h 37m
Merged PRs (30d)
344

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from solidjs/solid

All issues in solidjs/solid

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.