10x speed-up of event propagation

This commit is contained in:
zadam
2022-06-23 23:03:35 +02:00
parent ae46b3df58
commit 42e262a1c2
3 changed files with 25 additions and 9 deletions

View File

@@ -186,9 +186,13 @@ export default class RibbonContainer extends NoteContextAwareWidget {
const activeChild = this.getActiveRibbonWidget();
if (activeChild && (refreshActiveTab || !wasAlreadyActive)) {
activeChild.handleEvent('noteSwitched', {noteContext: this.noteContext, notePath: this.notePath}).then(() => {
const handleEventPromise = activeChild.handleEvent('noteSwitched', {noteContext: this.noteContext, notePath: this.notePath});
if (handleEventPromise) {
handleEventPromise.then(() => activeChild.focus?.());
} else {
activeChild.focus?.();
});
}
}
} else {
this.lastActiveComponentId = null;