Skip to content

Commit

Permalink
fix(array-repeat): properly check when to ignore update views
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Mar 13, 2019
1 parent 45d1209 commit 9b9d5b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/array-virtual-repeat-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
const overrideContext = view.overrideContext;
// any changes to the binding context?
if (bindingContext[local] === items[currIndex]
&& overrideContext.$index === currIndex
&& overrideContext.$middle === middle
&& overrideContext.$last === last
) {
Expand All @@ -109,9 +110,13 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
}
// update the binding context and refresh the bindings.
bindingContext[local] = items[currIndex];
overrideContext.$first = currIndex === 0;
overrideContext.$middle = middle;
overrideContext.$last = last;
overrideContext.$index = currIndex;
const odd = currIndex % 2 === 1;
overrideContext.$odd = odd;
overrideContext.$even = !odd;
repeat.updateBindings(view);
}
// add new views
Expand Down

0 comments on commit 9b9d5b7

Please sign in to comment.