Giter VIP home page Giter VIP logo

Comments (5)

mweststrate avatar mweststrate commented on July 17, 2024 1

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.

mweststrate avatar mweststrate commented on July 17, 2024 1

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.

mweststrate avatar mweststrate commented on July 17, 2024

Would you mind trying setting the setUseStrictShallowCopy(false) flag? Maybe in combination with version 10.0.4-beta?

from immer.

joshkel avatar joshkel commented on July 17, 2024

@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.

NMinhNguyen avatar NMinhNguyen commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.