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

not working with dynamic selector #346

Open
admir86 opened this issue Oct 29, 2019 · 3 comments
Open

not working with dynamic selector #346

admir86 opened this issue Oct 29, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@admir86
Copy link

admir86 commented Oct 29, 2019

@ImmutableSelector() is not working when using dynamic selector with arguments.
See error below.

First argument to `createDraft` must be a plain object, an array, or an immerable object

repro on stackblitz: https://stackblitz.com/edit/ngxs-repro-hgjaa9?file=src/app/app.state.ts

What is the right way to guarantee immutability when using dynamic selectors?

@splincode
Copy link
Member

splincode commented Oct 29, 2019

The default primitives (String, Number, Boolean) are immutable, you don’t need then @ImmutableSelector, @ImmutableContext

@admir86
Copy link
Author

admir86 commented Oct 29, 2019

Hi @splincode
I'm not creating a counter in my app :) this was just the simplest way to make a repro. I could change the StateModel to an object or an array, the behavior is the same.

@splincode splincode added the bug Something isn't working label Oct 29, 2019
@splincode
Copy link
Member

So, I will investigate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants