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

Allow useStrictShallowCopy from immer to be configurable in configureStore #4639

Open
orkhanrustamli opened this issue Sep 23, 2024 · 1 comment

Comments

@orkhanrustamli
Copy link

orkhanrustamli commented Sep 23, 2024

Issue

Accessors (getters/setters) Are Not Copied After immer@10 Update

Description:

Starting with Immer v10, the library stopped copying accessors (i.e., getters/setters) during object updates in drafts. This has caused issues for objects in my state that rely on getters, as these accessors are removed after the next state update due to Immer's behavior.

Proposed Solution:

Would it be possible to introduce new Immer settings that can be passed through configureStore, or perhaps export useStrictShallowCopy alongside the other Immerexports in Redux Toolkit, so this behavior can be enabled as an opt-in feature?

@markerikson
Copy link
Collaborator

No, this isn't something we'd want to support. Your state should be plain objects that don't rely on getters in the first place, and this isn't something we'd want to provide as an option in configureStore.

Just out of curiosity, what are you doing with your state objects that has you putting getters in there? And how are you adding getters to the objects?

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

No branches or pull requests

2 participants