Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 2 tasks
Wxh16144 opened this issue Mar 5, 2024 · 1 comment · May be fixed by FengShangWuQi/fengshangwuqi.github.io#1899
Closed
1 of 2 tasks

Comments

@Wxh16144
Copy link

Wxh16144 commented Mar 5, 2024

🙋‍♂ 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"

Copy link
Contributor

github-actions bot commented Mar 9, 2024

🎉 This issue has been resolved in version 10.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants