Don't allow overriding relations
Opened this issue · 0 comments
SpaceK33z commented
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.