all access to notes and branches is now async so we can lazy load it in the future

This commit is contained in:
azivner
2018-03-25 14:49:20 -04:00
parent 297a2cd9da
commit 54e4f54678
11 changed files with 98 additions and 76 deletions

View File

@@ -26,7 +26,7 @@ function addRecentNote(branchId, notePath) {
}, 1500);
}
function showDialog() {
async function showDialog() {
glob.activeDialog = $dialog;
$dialog.dialog({
@@ -40,25 +40,28 @@ function showDialog() {
// remove the current note
const recNotes = list.filter(note => note !== treeService.getCurrentNotePath());
const items = [];
for (const notePath of recNotes) {
let noteTitle;
try {
noteTitle = await treeService.getNotePathTitle(notePath);
}
catch (e) {
noteTitle = "[error - can't find note title]";
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
}
items.push({
label: noteTitle,
value: notePath
});
}
$searchInput.autocomplete({
source: recNotes.map(notePath => {
let noteTitle;
try {
noteTitle = treeService.getNotePathTitle(notePath);
}
catch (e) {
noteTitle = "[error - can't find note title]";
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
}
return {
label: noteTitle,
value: notePath
}
}),
source: items,
minLength: 0,
autoFocus: true,
select: function (event, ui) {