fix: ensure that this.data is set in NumberCardWidget (#22527)

This commit is contained in:
Sagar Vora 2023-09-25 14:55:49 +05:30 committed by GitHub
parent 78934a5aa5
commit 4b1da7fe28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,7 @@ export default class NumberCardWidget extends Widget {
}
this.settings = this.get_settings(this.card_doc.type);
this.data = await this.get_data();
await this.get_data();
this.render_number();
this.render_stats();
@ -176,10 +176,9 @@ export default class NumberCardWidget extends Widget {
</div>`);
}
get_data() {
return frappe
.xcall(this.settings.method, this.settings.args)
.then((res) => this.settings.get_number(res));
async get_data() {
this.data = await frappe.xcall(this.settings.method, this.settings.args);
return this.settings.get_number(this.data);
}
get_number_for_custom_card(res) {