Skip to content

Don't allow overriding relations #38

@SpaceK33z

Description

@SpaceK33z

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions