From 358b7cc0c0d3c5ce2ac98aa05643b77eb1d9cd90 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 29 Aug 2013 01:01:28 +0200 Subject: [PATCH] Don't add records to expandable array if they're already there --- assets/scripts/lib/travis/expandable_record_array.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/scripts/lib/travis/expandable_record_array.coffee b/assets/scripts/lib/travis/expandable_record_array.coffee index 2d377986..778b9f6b 100644 --- a/assets/scripts/lib/travis/expandable_record_array.coffee +++ b/assets/scripts/lib/travis/expandable_record_array.coffee @@ -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)