immerjs / immer

Create the next immutable state by mutating the current one

Home Page:https://immerjs.github.io/immer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When ImmerJS processes objects containing Symbol keys, the Symbols become Proxies.

Wxh16144 opened this issue Β· comments

πŸ™‹β€β™‚ Question

Hello everyone,

I recently started using ImmerJS and encountered a challenging issue. In my data structure, there is a property with a key as Symbol, which is only used for querying purposes and will not be modified when using ImmerJS. Specifically, I try to query and modify certain data through v[S1].id.

However, when outputting the result in the console, I noticed that although the corresponding value was successfully modified, strangely my Symbol key S1 was converted into a Proxy object. This has left me feeling very confused and frustrated.

Could you please let me know if this is a known bug or behavior caused by some boundary conditions? If anyone can provide an explanation or point to relevant documentation/discussion links, I would greatly appreciate it. Thank you all!

image

Link to repro

Please provide a CodeSandbox demo to clarify your question if possible. Typically, questions without minimal codesandbox demo won't be answered.

Environment

We only accept questions against the latest Immer version.

  • Immer version:
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)

version: "immer": "^10.0.2"

πŸŽ‰ This issue has been resolved in version 10.0.4 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€