Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return promise #17646

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 13 additions & 14 deletions frappe/public/js/frappe/ui/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ frappe.ui.Tree = class {
}

reload_node(node) {
this.load_children(node);
return this.load_children(node);
}

toggle() {
Expand All @@ -150,21 +150,20 @@ frappe.ui.Tree = class {
}

load_children(node, deep=false) {
let lab = node.label, value = node.data.value, is_root = node.is_root;

if(!deep) {
frappe.run_serially([
const value = node.data.value,
is_root = node.is_root;

return deep
? frappe.run_serially([
() => this.get_all_nodes(value, is_root, node.label),
data_list => this.render_children_of_all_nodes(data_list),
() => this.set_selected_node(node),
])
: frappe.run_serially([
() => this.get_nodes(value, is_root),
(data_set) => this.render_node_children(node, data_set),
() => this.set_selected_node(node)
]);
} else {
frappe.run_serially([
() => this.get_all_nodes(value, is_root, lab),
(data_list) => this.render_children_of_all_nodes(data_list),
() => this.set_selected_node(node)
data_set => this.render_node_children(node, data_set),
() => this.set_selected_node(node),
]);
}
}

render_children_of_all_nodes(data_list) {
Expand Down