Don't add records to expandable array if they're already there

This commit is contained in:
Piotr Sarnacki 2013-08-29 01:01:28 +02:00
parent fb120af69e
commit 358b7cc0c0

View File

@ -12,7 +12,7 @@ Travis.ExpandableRecordArray = Ember.RecordArray.extend
array.removeObserver 'isLoaded', observer
array.forEach (record) ->
self.pushObject record
self.pushObject(record) unless self.contains(record)
self.set 'isLoading', false
self.set 'isLoaded', true
@ -30,7 +30,8 @@ Travis.ExpandableRecordArray = Ember.RecordArray.extend
addedObjects = array.slice index, index + addedCount
for object in addedObjects
if @get('filterWith').call this, object
@pushObject object
@pushObject(object) unless @contains(object)
pushObject: (record) ->
@get('content').pushObject(record)
if content = @get('content')
content.pushObject(record) unless content.contains(record)