Merge pull request #37650 from frappe/35727-kanban-view-has-no-pagination-or-limit
fix(optimized): KanbanView field fetching by limiting to required fields and board configurations
This commit is contained in:
commit
f342ab8ff4
1 changed files with 24 additions and 2 deletions
|
|
@ -163,8 +163,30 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView {
|
|||
}
|
||||
|
||||
set_fields() {
|
||||
super.set_fields();
|
||||
// Fetch only required + Kanban Board configured fields (optimization: avoid fetching all doctype fields)
|
||||
this.fields = [];
|
||||
// Core: identity and column
|
||||
this._add_field("name");
|
||||
this._add_field("creation");
|
||||
this._add_field(this.board.field_name, this.board.reference_doctype);
|
||||
this._add_field(this.card_meta.title_field);
|
||||
// Card UI: assignments, tags, like, comment count
|
||||
this._add_field("_assign");
|
||||
this._add_field("_user_tags");
|
||||
this._add_field("_liked_by");
|
||||
this._add_field("_comments");
|
||||
this._add_field("owner");
|
||||
// Kanban Board document's configured fields (card body content)
|
||||
if (this.board.fields && Array.isArray(this.board.fields)) {
|
||||
this.board.fields.forEach((field_spec) => {
|
||||
const fieldname =
|
||||
typeof field_spec === "string" ? field_spec : field_spec?.fieldname;
|
||||
if (fieldname) this._add_field(fieldname);
|
||||
});
|
||||
}
|
||||
// Optional: image and color if doctype has them
|
||||
if (this.meta.image_field) this._add_field(this.meta.image_field);
|
||||
if (frappe.meta.has_field(this.doctype, "color")) this._add_field("color");
|
||||
}
|
||||
|
||||
before_render() {
|
||||
|
|
@ -208,7 +230,7 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView {
|
|||
}
|
||||
|
||||
get_fields() {
|
||||
this.fields.push([this.board.field_name, this.board.reference_doctype]);
|
||||
// board.field_name already added in set_fields(); just return built field list
|
||||
return super.get_fields();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue