Comments (5)
Argh, the JS world is impossible. 50% is like "non-enumerables and proxies have very specific meanings", and the other half is like "I expect non-enumerables and symbol to work just like the rest, why treat them irregularly" π€£
from immer.
Yeah I guess the only way to deal with this is to make all the behavior of irregular properties of any kind (enumerable x getter x proxy) all configurable. That will be a a bit bigger project though so probably more for a next major.
from immer.
Would you mind trying setting the setUseStrictShallowCopy(false)
flag? Maybe in combination with version 10.0.4-beta
?
from immer.
@mweststrate I get it. I apologize for contributing to your pain as an open-source maintainer.
setUseStrictShallowCopy(false)
with 10.0.4 or 10.0.4-beta seems to have no effect.
For what it's worth, Immer 9.x's behavior seemed consistent and worked for my purposes:
- Preexisting symbol props are skipped by Immer, as consistent with
Object.values
,JSON.stringify
, etc. (I.e., this issue.) - If I add/set a symbol prop within Immer, it handles it well enough to avoid leaking proxies. (I.e., #1087.)
Hopefully that's too ad hoc / too much of a special case - but, if you decide it is, I understand.
from immer.
Another way to reproduce this is trying to modify an object that contains React context: https://codesandbox.io/p/devbox/festive-gagarin-9mkfx9
For what itβs worth, the repro seems to work using [email protected]
from immer.
Related Issues (20)
- Is there any plan for support enableES5? HOT 2
- `produce` leaks proxy objects when symbols are present HOT 8
- Wrong description for "Question" issue type on "New Issue" page HOT 2
- In Vue 2's array, using push causes an error HOT 1
- How to deep clone ignoring immer references? (deepCurrent vs currrent) HOT 4
- Immer problem HOT 1
- Is there a way to convert object types in TypeScript in produce? HOT 2
- When ImmerJS processes objects containing Symbol keys, the Symbols become Proxies. HOT 1
- Property ... is missing in type WritableDraft<...> but required in type ... HOT 1
- Use Immer Reducer to create Composite Object HOT 5
- type WritableDraft is not exported anywhere in dist, this causes build type declaration files with Draft finally fall back to raw and causing the type declaration exceeds max token length
- Array update speed HOT 1
- Options for older browser support in v10 (or continuing to use v9 somehow?) HOT 4
- Object values of a `Map` are not frozen anymore HOT 2
- Can immer.js can be used for future mutations? HOT 3
- Maybe update docs
- Configure rollup
- Typescript: Cannot assign immutable state from payload to immutable writable draft HOT 2
- Unable to pass generic to produce for dynamic typing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from immer.