Skip to content

Unintentional use of produce can cause infinite loop #661

Closed

Description

@phungleson

IMPORTANT: If you have a question or an idea for a new feature use Github Discussions instead

Hey, I am not sure if this is a bug or just some un/expected behaviour, so I keep in here for now.

Describe the bug

This code causes Maximum call stack size exceeded.

https://playground.solidjs.com/?hash=708751962&version=1.1.1

While if I use the line below, it is fine setStore('items', (items) => [...items, ref_]);

To Reproduce
https://playground.solidjs.com/?hash=708751962&version=1.1.1

Expected behavior
The it should not cause Maximum call stack size exceeded and ideally produce should behave the same way with spreading.

Reproduction
https://playground.solidjs.com/?hash=708751962&version=1.1.1

Additional context
Not sure if store.items.length causes the component to re-render then subsequently cause createEffect to re-trigger and add more into store.items then subsequently cause re-render, which produce an infinite loop.

Activity

  1. ryansolid commented on Sep 20, 2021

    @ryansolid
    Member

    I see.. damn I introduced this in 1.0.0-rc.7 before the 1.0 release when I refactored out stores. Thanks for reporting. I will get this fixed up shortly.

  2. phungleson commented on Sep 21, 2021

    @phungleson
    ContributorAuthor

    Thanks

  3. added a commit that references this issue on Jan 24, 2025
    4ee8d22
  4. added a commit that references this issue on Nov 12, 2025
    ab44a1a
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions