Skip to content

Commit

Permalink
[BUGFIX release] Enumerate relationships provided, not all on a given…
Browse files Browse the repository at this point in the history
… schema
  • Loading branch information
stefanpenner committed Aug 25, 2017
1 parent 50592d8 commit 19d3dd5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2429,9 +2429,10 @@ Store = Service.extend({
// payload push. In the common case where we are pushing many more
// instances than types we want to minimize the cost of looking up the
// inverse map and the overhead of Ember.get adds up.
let modelNameToInverseMap = Object.create(null);
let modelNameToInverseMap;

for (let i = 0, l = pushed.length; i < l; i += 2) {
modelNameToInverseMap = modelNameToInverseMap || Object.create(null);
// This will convert relationships specified as IDs into DS.Model instances
// (possibly unloaded) and also create the data structures used to track
// relationships.
Expand Down Expand Up @@ -2870,13 +2871,8 @@ function isInverseRelationshipInitialized(store, internalModel, data, key, model
}

function setupRelationships(store, internalModel, data, modelNameToInverseMap) {
let relationships = internalModel._relationships;

internalModel.type.eachRelationship(relationshipName => {
if (!data.relationships[relationshipName]) {
return;
}

Object.keys(data.relationships).forEach(relationshipName => {
let relationships = internalModel._relationships;
let relationshipRequiresNotification = relationships.has(relationshipName) ||
isInverseRelationshipInitialized(store, internalModel, data, relationshipName, modelNameToInverseMap);

Expand Down

0 comments on commit 19d3dd5

Please sign in to comment.