Skip to content

Commit

Permalink
Run findHasMany inside an ED runloop
Browse files Browse the repository at this point in the history
In #2576 we added a runloop inside ED,
in order to handle relationship deserializing and make sure we coalesce hasMany
/belongsTo changes. However in that PR we missed the findHasMany call, causing us
to trigger a flush(triggering an arrayWill/DidChange) once for every record being
parsed. This commit ensures we first process all the records together, and then call
flush only once. Was not sure how test this without a super specific unit test.
  • Loading branch information
igorT committed Mar 12, 2015
1 parent 673e477 commit b348cbd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ ManyRelationship.prototype.computeChanges = function(records) {
ManyRelationship.prototype.fetchLink = function() {
var self = this;
return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function(records) {
self.updateRecordsFromAdapter(records);
self.store._backburner.join(function() {
self.updateRecordsFromAdapter(records);
});
return self.manyArray;
});
};
Expand Down

0 comments on commit b348cbd

Please sign in to comment.