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":
|
||||
this.listAdapter.batchCount = 15;
|
||||
break;
|
||||
case "subviews":
|
||||
break;
|
||||
default:
|
||||
super.blend(view, name, prop);
|
||||
break;
|
||||
|
@ -43,7 +43,7 @@ export interface IList extends IView {
|
||||
|
||||
export class List extends Superview implements IList {
|
||||
private cachedViews: Map<string, ListItem> = new Map
|
||||
|
||||
private ignoreDirtyCallOnce = false
|
||||
allSubviews() {
|
||||
return this.cachedViews.values()
|
||||
}
|
||||
@ -67,7 +67,17 @@ export class List extends Superview implements IList {
|
||||
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) {
|
||||
this.ignoreDirtyCallOnce = true;
|
||||
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
||||
const listItem = this.getItem(start + idx)
|
||||
return listItem.toModel()
|
||||
|
Reference in New Issue
Block a user