Permalink
Browse files

fix(set-repeat-strategy): fix negative index error with empty set

closes #284
  • Loading branch information...
tkhyn committed Jun 30, 2017
1 parent 0b93b6a commit 5d6a4649935a9ba2e69fc986e99a5c79115906e0
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/set-repeat-strategy.js
@@ -57,8 +57,9 @@ export class SetRepeatStrategy {
value = record.value;
switch (record.type) {
case 'add':
overrideContext = createFullOverrideContext(repeat, value, set.size - 1, set.size);
repeat.insertView(set.size - 1, overrideContext.bindingContext, overrideContext);
let size = Math.max(set.size - 1, 0);
overrideContext = createFullOverrideContext(repeat, value, size, set.size);
repeat.insertView(size, overrideContext.bindingContext, overrideContext);
break;
case 'delete':
removeIndex = this._getViewIndexByValue(repeat, value);

0 comments on commit 5d6a464

Please sign in to comment.