Skip to content

Commit

Permalink
js:fix list renderBunchedItems array size <0
Browse files Browse the repository at this point in the history
  • Loading branch information
penfeizhou committed Mar 31, 2020
1 parent a265371 commit 5d3016f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doric-js/bundle/doric-lib.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ var List = /** @class */ (function (_super) {
List.prototype.renderBunchedItems = function (start, length) {
var _this = this;
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map(function (_, idx) {
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map(function (_, idx) {
var listItem = _this.getItem(start + idx);
return listItem.toModel();
});
Expand Down
2 changes: 1 addition & 1 deletion doric-js/bundle/doric-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ class List extends Superview {
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
Expand Down
2 changes: 1 addition & 1 deletion doric-js/bundle/doric-vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ class List extends Superview {
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
Expand Down
2 changes: 1 addition & 1 deletion doric-js/lib/src/widget/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class List extends Superview {
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
Expand Down
2 changes: 1 addition & 1 deletion doric-js/src/widget/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class List extends Superview implements IList {

private renderBunchedItems(start: number, length: number) {
this.ignoreDirtyCallOnce = true
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx)
return listItem.toModel()
})
Expand Down
2 changes: 1 addition & 1 deletion doric-web/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d3016f

Please sign in to comment.