Skip to content

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

@taras

Description

@taras

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions