improvements in widgets rendering - individual widget render is now async while composing them together to the sidebar is sync which solves some race problems

This commit is contained in:
zadam
2019-09-08 09:40:29 +02:00
parent 2dae9b9621
commit 90afb2a1ee
3 changed files with 25 additions and 14 deletions

View File

@@ -43,7 +43,7 @@ class StandardWidget {
getPosition() { return this.widgetOptions.position; }
async render() {
render() {
const widgetId = `tab-${this.ctx.tabId}-widget-${this.widgetName}`;
this.$widget = $(WIDGET_TPL);
@@ -73,7 +73,8 @@ class StandardWidget {
this.$headerActions = this.$widget.find('.widget-header-actions');
this.$headerActions.append(...this.getHeaderActions());
await this.renderBody();
// actual rendering is async
this.renderBody();
return this.$widget;
}