Skip to content

Commit

Permalink
Don't notify relationships with links during initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mmun committed Aug 9, 2017
1 parent 1d2ff61 commit 427a53f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions addon/-private/system/relationships/state/relationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export default class Relationship {
this.store._updateRelationshipState(this);
}

updateLink(link) {
updateLink(link, initial) {
heimdall.increment(updateLink);
warn(`You pushed a record of type '${this.internalModel.modelName}' with a relationship '${this.key}' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload.`, this.isAsync || this.hasData , {
id: 'ds.store.push-link-for-sync-relationship'
Expand All @@ -355,7 +355,10 @@ export default class Relationship {

this.link = link;
this.linkPromise = null;
this.internalModel.notifyPropertyChange(this.key);

if (!initial) {
this.internalModel.notifyPropertyChange(this.key);
}
}

findLink() {
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,7 @@ function setupRelationships(store, internalModel, data, modelNameToInverseMap) {

if (relationshipRequiresNotification) {
let relationshipData = data.relationships[relationshipName];
relationships.get(relationshipName).push(relationshipData);
relationships.get(relationshipName).push(relationshipData, false);
}

// in debug, assert payload validity eagerly
Expand Down

0 comments on commit 427a53f

Please sign in to comment.