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

Don't allow overriding relations #38

Open
SpaceK33z opened this issue May 24, 2017 · 0 comments
Open

Don't allow overriding relations #38

SpaceK33z opened this issue May 24, 2017 · 0 comments

Comments

@SpaceK33z
Copy link
Contributor

SpaceK33z commented May 24, 2017

In some of our projects I have seen @abzainuddin or @jasperstam do this:

class Animal extends Model {
  relations() {
    return { kind: Kind };
  }
}

const animal = new Animal(null, { relations: ['kind'] );
// ...
animal.kind = null;
// ...
animal.kind = new Kind();

Overriding the relation like this seems to work, but it results in very hard to debug scenarios because MobX doesn't understand what happened here and doesn't properly track changes after resetting the relation.

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

No branches or pull requests

1 participant