fix: refresh tree when the treeview is loaded

This commit is contained in:
hrwx 2022-07-03 00:48:09 +01:00
parent cc15cc73eb
commit fb0bc3bdcd

View file

@ -21,6 +21,19 @@ frappe.views.TreeFactory = class TreeFactory extends frappe.views.Factory {
frappe.views.trees[options.doctype] = new frappe.views.TreeView(options);
});
}
on_show() {
/**
* When the the treeview is visited using the previous button,
* the framework just show the treeview element that is hidden.
* Due to this, the data of the tree can be old.
* To deal with this, the tree will be refreshed whenever the
* treeview is visible.
*/
let route = frappe.get_route();
let treeview = frappe.views.trees[route[1]];
treeview && treeview.make_tree();
}
}
frappe.views.TreeView = class TreeView {