initial load of tabs can run partially asynchronously to speed things up

This commit is contained in:
zadam 2019-09-03 22:01:45 +02:00
parent e36d636f93
commit aa96b33bc2
2 changed files with 14 additions and 6 deletions

View File

@ -276,11 +276,18 @@ async function loadNoteDetail(origNotePath, options = {}) {
return; return;
} }
await loadNoteDetailToContext(ctx, loadedNote, notePath); const loadPromise = loadNoteDetailToContext(ctx, loadedNote, notePath).then(() => {
if (activate) {
// will also trigger showTab via event
return tabRow.activateTab(ctx.$tab[0]);
}
else {
return Promise.resolve();
}
});
if (activate) { if (!options.async) {
// will also trigger showTab via event await loadPromise;
await tabRow.activateTab(ctx.$tab[0]);
} }
} }

View File

@ -391,7 +391,8 @@ async function treeInitialized() {
await noteDetailService.loadNoteDetail(tab.notePath, { await noteDetailService.loadNoteDetail(tab.notePath, {
state: tab, state: tab,
newTab: true, newTab: true,
activate: tab.active activate: tab.active,
async: true // faster initial load
}); });
} }