From 9b9d5b78e857a158be0442d88e17639f87968347 Mon Sep 17 00:00:00 2001 From: "bigopon.777@gmail.com" Date: Thu, 14 Mar 2019 00:29:03 +1100 Subject: [PATCH] fix(array-repeat): properly check when to ignore update views --- src/array-virtual-repeat-strategy.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/array-virtual-repeat-strategy.ts b/src/array-virtual-repeat-strategy.ts index b1aba5d..0e80ae1 100644 --- a/src/array-virtual-repeat-strategy.ts +++ b/src/array-virtual-repeat-strategy.ts @@ -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 ) { @@ -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