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

Class Symbol Property Cannot be changed Twice #620

Closed
3 tasks done
rafaelcalpena opened this issue Jun 15, 2020 · 2 comments
Closed
3 tasks done

Class Symbol Property Cannot be changed Twice #620

rafaelcalpena opened this issue Jun 15, 2020 · 2 comments

Comments

@rafaelcalpena
Copy link

🐛 Bug Report

This seems to be a regression (used to work in version 6). A Symbol property in a Class cannot be changed twice (2 consecutive producers). I assume this has to do with object freezing being applied because the given error is Cannot assign to read only property 'Symbol(customSymbol)' of object.

Link to repro

https://codesandbox.io/s/immer-bug-018r6?file=/src/index.ts

To Reproduce

Steps to reproduce the behavior:

  1. Create Immerable Class and add some symbol as a property key.
  2. Instantiate class and produce new instance by mutating symbol property value.
  3. Repeat step 2 with another variable. Code should break in version 7 (but not in version 6).

Observed behavior

Inconsistent update behavior when producing twice. Maybe I'm missing some new API required to change the symbol? Though if that's the case (object freeze), I'd suggest rolling back to previous behavior if possible. New behavior could be a bit unpredictable.

Expected behavior

Both produce calls should work without errors thrown.

Environment

We only accept bug reports against the latest Immer version.

  • Immer version:
  • I filed this report against the latest version of Immer
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)
@mweststrate
Copy link
Collaborator

That looks like a regression indeed, thanks for the detailed report!

@aleclarson
Copy link
Member

🎉 This issue has been resolved in version 7.0.2 🎉

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

No branches or pull requests

3 participants