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

Give developers better feedback when they try to mutate state property #81

Open
taras opened this issue Nov 29, 2018 · 0 comments
Open
Labels
good first issue Issues that are a good place for beginners to start help wanted

Comments

@taras
Copy link
Member

taras commented Nov 29, 2018

Microstates are immutable, as such changing value on state property doesn't make sense. Unfortunately, some components do this without the developer realizing it.

Currently, if Ember tries to set state property, the developer will get an error like this: Uncaught TypeError: Cannot set property state of #<Primitive> which has only a getter.

This is not very descriptive. Instead, we should give them an error that tells them why this might be happening. Something like this: Ember tried to mutate the state property of a microstate locatet at [path]. You might have the state property two way bound to a property of a component. [link to readme with more information].

To make this change, we could add a setter for the state property to each primitive type. There might be a better way to do it, but it'd require changes to Microstates.js library.

@taras taras added help wanted good first issue Issues that are a good place for beginners to start labels Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are a good place for beginners to start help wanted
Projects
None yet
Development

No branches or pull requests

1 participant