diff --git a/js/angular/directive/collectionRepeat.js b/js/angular/directive/collectionRepeat.js
index 7d5e5a46cd..3f5c4ffb9d 100644
--- a/js/angular/directive/collectionRepeat.js
+++ b/js/angular/directive/collectionRepeat.js
@@ -4,7 +4,7 @@
* @restrict A
* @name collectionRepeat
* @module ionic
- * @codepen mFygh
+ * @codepen 7ec1ec58f2489ab8f359fa1a0fe89c15
* @description
* `collection-repeat` allows an app to show huge lists of items much more performantly than
* `ng-repeat`.
@@ -30,7 +30,7 @@
* if possible, lower the number of unique images. Check out [this codepen]().
*
* @usage
- * #### Basic Item List (codepen)
+ * #### Basic Item List ([codepen](http://codepen.io/ionic/pen/0c2c35a34a8b18ad4d793fef0b081693))
* ```html
*
*
@@ -39,7 +39,7 @@
*
* ```
*
- * #### Grid of Images (codepen)
+ * #### Grid of Images ([codepen])
* ```html
*
*
= data.length || itemsShownMap[i] && !forceRerender) continue;
+ // We only go forward with render if the index is in data, the item isn't already shown,
+ // or forceRerender is on.
+ if (i >= data.length || (itemsShownMap[i] && !forceRerender)) continue;
- item = itemsShownMap[i] || (itemsShownMap[i] = getNextItem());
+ item = itemsShownMap[i] || (itemsShownMap[i] = itemsLeaving.length ? itemsLeaving.pop() :
+ itemsPool.length ? itemsPool.shift() :
+ new RepeatItem())
itemsEntering.push(item);
item.isShown = true;
@@ -606,13 +619,13 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
$$rAF(function process() {
if( (len = itemsEntering.length) ) {
- var count = Math.floor(len / 1.5) || 1;
var rootScopePhase = $rootScope.$$phase;
+ var count = Math.floor(len / 1.25) || 1;
while (count && itemsEntering.length) {
item = itemsEntering.pop();
if (item.isShown) {
count--;
- if (!$rootScope.$$phase) item.scope.$digest();
+ if (!rootScopePhase) item.scope.$digest();
}
}
$$rAF(process);