various widget optimizations for faster note switching

This commit is contained in:
zadam
2020-02-03 21:16:33 +01:00
parent 66204811cf
commit 44ddcdd852
13 changed files with 111 additions and 96 deletions

View File

@@ -28,6 +28,18 @@ export default class LinkMapWidget extends CollapsibleWidget {
return [$showFullButton];
}
noteSwitched() {
const noteId = this.noteId;
// avoid executing this expensive operation multiple times when just going through notes (with keyboard especially)
// until the users settles on a note
setTimeout(() => {
if (this.noteId === noteId) {
this.refresh();
}
}, 1000);
}
async refreshWithNote(note) {
this.$body.css('opacity', 0);
this.$body.html(TPL);