Skip to content

Commit

Permalink
fix(array-virtual-repeat-strategy): handle instance changes with less…
Browse files Browse the repository at this point in the history
… items than in view slot

Fixes #41
  • Loading branch information
martingust committed Apr 7, 2016
1 parent cc11b8e commit 4eb9ca0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/array-virtual-repeat-strategy.js
Expand Up @@ -32,7 +32,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy {
let viewsLength = repeat.viewCount();
let first = repeat._getIndexOfFirstView();
// remove unneeded views.
while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/virtual-repeat.js
Expand Up @@ -126,7 +126,7 @@ export class VirtualRepeat extends AbstractRepeater {
}
let items = this.items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}
this._calcInitialHeights(items.length);
Expand Down

0 comments on commit 4eb9ca0

Please sign in to comment.