Skip to content

Commit

Permalink
Merge pull request #4893 from drewchandler/remove-relationship-guard
Browse files Browse the repository at this point in the history
Remove unnecessary relationship guard
  • Loading branch information
bmac committed Mar 28, 2017
2 parents 3509c58 + 0e9014b commit 42c97d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions addon/-private/system/relationships/state/has-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export default class ManyRelationship extends Relationship {
if (this.members.has(record)) {
return;
}

assertPolymorphicType(this.record, this.relationshipMeta, record);
super.addRecord(record, idx);
// make lazy later
this.manyArray.internalAddInternalModels([record], idx);
Expand Down Expand Up @@ -130,8 +132,6 @@ export default class ManyRelationship extends Relationship {
}

notifyRecordRelationshipAdded(record, idx) {
assertPolymorphicType(this.record, this.relationshipMeta, record);

this.record.notifyHasManyAdded(this.key, record, idx);
}

Expand Down
7 changes: 1 addition & 6 deletions addon/-private/system/relationships/state/relationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ export default class Relationship {

allMembers.forEach(inverseInternalModel => {
let relationship = inverseInternalModel._relationships.get(this.inverseKey);
// TODO: there is always a relationship in this case; this guard exists
// because there are tests that fail in teardown after putting things in
// invalid state
if (relationship) {
relationship.inverseDidDematerialize();
}
relationship.inverseDidDematerialize();
});
}

Expand Down

0 comments on commit 42c97d4

Please sign in to comment.