Skip to content

Commit

Permalink
make initialization of launchers more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 24, 2022
1 parent 4c51588 commit e2b227d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/public/app/widgets/containers/launcher_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export default class LauncherContainer extends FlexContainer {
async load() {
await froca.initializedPromise;

this.children = [];

const visibleLaunchersRoot = await froca.getNote('_lbVisibleLaunchers', true);

if (!visibleLaunchersRoot) {
Expand All @@ -27,20 +25,25 @@ export default class LauncherContainer extends FlexContainer {
return;
}

const newChildren = [];

for (const launcherNote of await visibleLaunchersRoot.getChildNotes()) {
try {
const launcherWidget = new LauncherWidget();
const success = await launcherWidget.initLauncher(launcherNote);

if (success) {
this.child(launcherWidget);
newChildren.push(launcherWidget);
}
}
catch (e) {
console.error(e);
}
}

this.children = [];
this.child(...newChildren);

this.$widget.empty();
this.renderChildren();

Expand Down
5 changes: 2 additions & 3 deletions src/public/app/widgets/sync_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ export default class SyncStatusWidget extends BasicWidget {
constructor() {
super();

ws.subscribeToMessages(message => this.processMessage(message));

this.syncState = 'unknown';
this.allChangesPushed = false;
}
Expand All @@ -93,8 +91,9 @@ export default class SyncStatusWidget extends BasicWidget {
});

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) {
Expand Down

0 comments on commit e2b227d

Please sign in to comment.