fixes to note loading. Sidebar flickers way less after note change

This commit is contained in:
zadam
2019-09-04 22:45:12 +02:00
parent a17b8a053e
commit 135102d2b5
4 changed files with 34 additions and 20 deletions

View File

@@ -59,7 +59,6 @@ class Sidebar {
}
this.widgets = [];
this.$widgetContainer.empty();
const widgetClasses = (await Promise.all([
import("../widgets/note_info.js"),
@@ -95,15 +94,19 @@ class Sidebar {
this.widgets.sort((a, b) => a.getPosition() < b.getPosition() ? -1 : 1);
const widgetsToAppend = [];
for (const widget of this.widgets) {
try {
const $el = await widget.render();
this.$widgetContainer.append($el);
widgetsToAppend.push($el);
}
catch (e) {
ws.logError(`Error while rendering widget ${widget.widgetName}: ${e.message}`);
}
}
this.$widgetContainer.empty().append(...widgetsToAppend);
}
eventReceived(name, data) {