immerjs / immerjs/immer

"Maximum call stack exceeded" with circular references

Open
#1,106 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
29k
Forks
881
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Report

Starting with Immer 10.0.4, if Immer is given an object that uses symbols for circular references, it generates a "Maximum call stack exceeded" error.

Link to repro

https://playcode.io/1794809

To Reproduce

Pass an object with pre-existing symbol circular references to Immer 10.0.4. (Circular references that are added within an Immer recipe do not cause problems.)

Observed behavior

"Maximum call stack exceeded"

Expected behavior

Our application uses symbols to create child-to-parent relationships. Since symbols are skipped by many JavaScript routines (e.g., JSON.stringify, Immer prior to 10.0.4), we had been able to do this without error.

Environment

  • Immer version: 10.0.4
  • I filed this report against the latest version of Immer

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by running the linked Playcode reproduction with Immer 10.0.4 and compare objects with symbol-based circular references against circular references added in a recipe. Trace the call path that recurses over the pre-existing symbol reference, then verify that the reproduction no longer raises "Maximum call stack exceeded" while the stated circular-reference behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.