mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
make initialization of launchers more robust
This commit is contained in:
parent
4c51588270
commit
e2b227df34
@ -17,8 +17,6 @@ export default class LauncherContainer extends FlexContainer {
|
|||||||
async load() {
|
async load() {
|
||||||
await froca.initializedPromise;
|
await froca.initializedPromise;
|
||||||
|
|
||||||
this.children = [];
|
|
||||||
|
|
||||||
const visibleLaunchersRoot = await froca.getNote('_lbVisibleLaunchers', true);
|
const visibleLaunchersRoot = await froca.getNote('_lbVisibleLaunchers', true);
|
||||||
|
|
||||||
if (!visibleLaunchersRoot) {
|
if (!visibleLaunchersRoot) {
|
||||||
@ -27,13 +25,15 @@ export default class LauncherContainer extends FlexContainer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const newChildren = [];
|
||||||
|
|
||||||
for (const launcherNote of await visibleLaunchersRoot.getChildNotes()) {
|
for (const launcherNote of await visibleLaunchersRoot.getChildNotes()) {
|
||||||
try {
|
try {
|
||||||
const launcherWidget = new LauncherWidget();
|
const launcherWidget = new LauncherWidget();
|
||||||
const success = await launcherWidget.initLauncher(launcherNote);
|
const success = await launcherWidget.initLauncher(launcherNote);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
this.child(launcherWidget);
|
newChildren.push(launcherWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@ -41,6 +41,9 @@ export default class LauncherContainer extends FlexContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.children = [];
|
||||||
|
this.child(...newChildren);
|
||||||
|
|
||||||
this.$widget.empty();
|
this.$widget.empty();
|
||||||
this.renderChildren();
|
this.renderChildren();
|
||||||
|
|
||||||
|
@ -78,8 +78,6 @@ export default class SyncStatusWidget extends BasicWidget {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
ws.subscribeToMessages(message => this.processMessage(message));
|
|
||||||
|
|
||||||
this.syncState = 'unknown';
|
this.syncState = 'unknown';
|
||||||
this.allChangesPushed = false;
|
this.allChangesPushed = false;
|
||||||
}
|
}
|
||||||
@ -93,8 +91,9 @@ export default class SyncStatusWidget extends BasicWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$widget.find('.sync-status-icon:not(.sync-status-in-progress)')
|
this.$widget.find('.sync-status-icon:not(.sync-status-in-progress)')
|
||||||
.on('click', () => syncService.syncNow())
|
.on('click', () => syncService.syncNow());
|
||||||
|
|
||||||
|
ws.subscribeToMessages(message => this.processMessage(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
showIcon(className) {
|
showIcon(className) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user