Skip to content

Commit

Permalink
Don't call arrayContentDidChange() if storeKeys already exist; this w…
Browse files Browse the repository at this point in the history
…ill be handled by the next call to flush().
  • Loading branch information
Tom Dale committed May 13, 2011
1 parent 3c5c8f6 commit 6d6ffcf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frameworks/datastore/system/record_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,13 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
},

/** @private
Called by the store whenever it changes the state of certain store keys.
If the receiver cares about these changes, it will mark itself as dirty.
The next time you try to access the record array it will update any
pending changes.
Called by the store whenever it changes the state of certain store keys. If
the receiver cares about these changes, it will mark itself as dirty and add
the changed store keys to the _scq_changedStoreKeys index set.
The next time you try to access the record array, it will call `flush()` and
add the changed keys to the underlying `storeKeys` array if the new records
match the conditions of the record array's query.
@param {SC.Array} storeKeys the effected store keys
@param {SC.Set} recordTypes the record types for the storeKeys.
Expand All @@ -448,11 +451,8 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
changed.addEach(storeKeys);

this.set('needsFlush', YES);

if (this.get('storeKeys')) {
this.flush();
} else {
this.arrayContentDidChange();
}

return this;
Expand Down

0 comments on commit 6d6ffcf

Please sign in to comment.