Skip to content

Commit 9b9d5b7

Browse files
committed
fix(array-repeat): properly check when to ignore update views
1 parent 45d1209 commit 9b9d5b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/array-virtual-repeat-strategy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
101101
const overrideContext = view.overrideContext;
102102
// any changes to the binding context?
103103
if (bindingContext[local] === items[currIndex]
104+
&& overrideContext.$index === currIndex
104105
&& overrideContext.$middle === middle
105106
&& overrideContext.$last === last
106107
) {
@@ -109,9 +110,13 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
109110
}
110111
// update the binding context and refresh the bindings.
111112
bindingContext[local] = items[currIndex];
113+
overrideContext.$first = currIndex === 0;
112114
overrideContext.$middle = middle;
113115
overrideContext.$last = last;
114116
overrideContext.$index = currIndex;
117+
const odd = currIndex % 2 === 1;
118+
overrideContext.$odd = odd;
119+
overrideContext.$even = !odd;
115120
repeat.updateBindings(view);
116121
}
117122
// add new views

0 commit comments

Comments
 (0)