Skip to content

Commit c9de65b

Browse files
committed
fix(virtual-repeat): remove buffer size
1 parent 57cd66d commit c9de65b

File tree

4 files changed

+162
-90
lines changed

4 files changed

+162
-90
lines changed

src/array-virtual-repeat-strategy.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
2222
this._inPlaceProcessItems(repeat, items, rest[0]);
2323
}
2424

25+
/**
26+
* Handle the repeat's collection instance mutating.
27+
* @param repeat The repeat instance.
28+
* @param array The modified array.
29+
* @param splices Records of array changes.
30+
*/
31+
instanceMutated(repeat: IVirtualRepeat, array: Array<any>, splices: any): void {
32+
this._standardProcessInstanceMutated(repeat, array, splices);
33+
}
34+
35+
/**@internal */
2536
_standardProcessInstanceChanged(repeat: IVirtualRepeat, items: Array<any>): void {
2637
for (let i = 1, ii = repeat._viewsLength; i < ii; ++i) {
2738
let overrideContext = createFullOverrideContext(repeat, items[i], i, ii);
2839
repeat.addView(overrideContext.bindingContext, overrideContext);
2940
}
3041
}
3142

43+
/**@internal */
3244
_inPlaceProcessItems(repeat: IVirtualRepeat, items: Array<any>, first: number): void {
3345
let itemsLength = items.length;
3446
let viewsLength = repeat.viewCount();
@@ -71,16 +83,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
7183
}
7284
}
7385

74-
/**
75-
* Handle the repeat's collection instance mutating.
76-
* @param repeat The repeat instance.
77-
* @param array The modified array.
78-
* @param splices Records of array changes.
79-
*/
80-
instanceMutated(repeat: IVirtualRepeat, array: Array<any>, splices: any): void {
81-
this._standardProcessInstanceMutated(repeat, array, splices);
82-
}
83-
86+
/**@internal */
8487
_standardProcessInstanceMutated(repeat: IVirtualRepeat, array: Array<any>, splices: any): void {
8588
if (repeat.__queuedSplices) {
8689
for (let i = 0, ii = splices.length; i < ii; ++i) {
@@ -110,6 +113,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
110113
}
111114
}
112115

116+
/**@internal */
113117
_runSplices(repeat: IVirtualRepeat, array: Array<any>, splices: any): any {
114118
let removeDelta = 0;
115119
let rmPromises = [];
@@ -185,7 +189,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy implements I
185189
viewOrPromise = repeat.removeView(viewIndex, returnToCache);
186190
if (repeat.items.length > viewCount) {
187191
// TODO: do not trigger view lifecycle here
188-
let collectionAddIndex;
192+
let collectionAddIndex: number;
189193
if (repeat._bottomBufferHeight > repeat.itemHeight) {
190194
viewAddIndex = viewCount;
191195
if (!removeMoreThanInDom) {

src/dom-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class DomHelper {
44
let documentElement = document.documentElement;
55
let scrollTop = window.pageYOffset;
66
let clientTop = documentElement.clientTop;
7-
let top = box.top + scrollTop - clientTop;
7+
let top = box.top + scrollTop - clientTop;
88
return Math.round(top);
99
}
1010

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Repeat, RepeatStrategy } from 'aurelia-templating-resources';
22
import { ViewSlot, View, ViewFactory, BoundViewFactory, Controller } from 'aurelia-templating';
3-
import { Scope, Binding } from 'aurelia-binding';
3+
import { Scope, Binding, OverrideContext } from 'aurelia-binding';
44
import { TaskQueue } from 'aurelia-task-queue';
55

66
/**@internal */

0 commit comments

Comments
 (0)