fix: after load more on refresh gets duplicate data

This commit is contained in:
Shariq Ansari 2022-02-15 20:24:03 +05:30
parent c961ea856b
commit af7dc6b774

View file

@ -391,9 +391,10 @@ frappe.views.BaseList = class BaseList {
$this.addClass("btn-info");
this.start = 0;
this.page_length = $this.data().value;
this.page_length = this.selected_page_count = $this.data().value;
} else if ($this.is(".btn-more")) {
this.start = this.start + this.page_length;
this.page_length = this.selected_page_count || 20;
}
this.refresh();
});
@ -474,6 +475,7 @@ frappe.views.BaseList = class BaseList {
this.render();
this.after_render();
this.freeze(false);
this.reset_defaults();
if (this.settings.refresh) {
this.settings.refresh(this);
}
@ -500,6 +502,11 @@ frappe.views.BaseList = class BaseList {
this.data = this.data.uniqBy((d) => d.name);
}
reset_defaults() {
this.page_length = this.page_length + this.start;
this.start = 0;
}
freeze() {
// show a freeze message while data is loading
}