mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
lazy loading of note complement
This commit is contained in:
@@ -51,9 +51,6 @@ class TabContext extends Component {
|
||||
/** @property {NoteShort} */
|
||||
this.note = await treeCache.getNote(noteId);
|
||||
|
||||
/** @property {NoteComplement} */
|
||||
this.noteComplement = await noteDetailService.loadNoteComplement(noteId);
|
||||
|
||||
//this.cleanup(); // esp. on windows autocomplete is not getting closed automatically
|
||||
|
||||
setTimeout(async () => {
|
||||
@@ -78,6 +75,23 @@ class TabContext extends Component {
|
||||
this.trigger('openTabsChanged');
|
||||
}
|
||||
|
||||
get noteId() {
|
||||
return this.note && this.note.noteId;
|
||||
}
|
||||
|
||||
/** @return {NoteComplement} */
|
||||
async getNoteComplement() {
|
||||
if (!this.noteId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.noteComplementPromise) {
|
||||
this.noteComplementPromise = noteDetailService.loadNoteComplement(this.noteId);
|
||||
}
|
||||
|
||||
return await this.noteComplementPromise;
|
||||
}
|
||||
|
||||
async remove() {
|
||||
await this.trigger('beforeTabRemove', {tabId: this.tabId}, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user