feat:ignore the dirty call once to avoid after renderBunched items call render again
This commit is contained in:
parent
401d0e57a0
commit
8d582e3371
@ -80,8 +80,6 @@ public class ListNode extends SuperNode<RecyclerView> {
|
|||||||
case "batchCount":
|
case "batchCount":
|
||||||
this.listAdapter.batchCount = 15;
|
this.listAdapter.batchCount = 15;
|
||||||
break;
|
break;
|
||||||
case "subviews":
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
super.blend(view, name, prop);
|
super.blend(view, name, prop);
|
||||||
break;
|
break;
|
||||||
|
@ -43,7 +43,7 @@ export interface IList extends IView {
|
|||||||
|
|
||||||
export class List extends Superview implements IList {
|
export class List extends Superview implements IList {
|
||||||
private cachedViews: Map<string, ListItem> = new Map
|
private cachedViews: Map<string, ListItem> = new Map
|
||||||
|
private ignoreDirtyCallOnce = false
|
||||||
allSubviews() {
|
allSubviews() {
|
||||||
return this.cachedViews.values()
|
return this.cachedViews.values()
|
||||||
}
|
}
|
||||||
@ -67,7 +67,17 @@ export class List extends Superview implements IList {
|
|||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDirty() {
|
||||||
|
if (this.ignoreDirtyCallOnce) {
|
||||||
|
this.ignoreDirtyCallOnce = false
|
||||||
|
//Ignore the dirty call once.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return super.isDirty()
|
||||||
|
}
|
||||||
|
|
||||||
private renderBunchedItems(start: number, length: number) {
|
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.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
||||||
const listItem = this.getItem(start + idx)
|
const listItem = this.getItem(start + idx)
|
||||||
return listItem.toModel()
|
return listItem.toModel()
|
||||||
|
Reference in New Issue
Block a user