fix: timing of editor component view unloading

This commit is contained in:
Mo Bitar
2020-04-23 20:20:56 -05:00
parent 7a615bc137
commit fa831f775b
4 changed files with 463 additions and 520 deletions

View File

@@ -202,6 +202,13 @@ class NotesViewCtrl extends PureViewCtrl {
[ContentType.Note],
async (items) => {
const notes = items as SNNote[];
/** Note has changed values, reset its flags */
for (const note of notes) {
if (note.deleted) {
continue;
}
this.loadFlagsForNote(note);
}
/** If a note changes, it will be queried against the existing filter;
* we dont need to reload display options */
await this.reloadNotes();
@@ -214,13 +221,6 @@ class NotesViewCtrl extends PureViewCtrl {
} else {
this.selectFirstNote();
}
/** Note has changed values, reset its flags */
for (const note of notes) {
if (note.deleted) {
continue;
}
this.loadFlagsForNote(note);
}
}
);
@@ -332,11 +332,6 @@ class NotesViewCtrl extends PureViewCtrl {
return;
}
const notes = this.application.getDisplayableItems(ContentType.Note) as SNNote[];
for (const note of notes) {
if (note.errorDecrypting) {
this.loadFlagsForNote(note);
}
}
await this.setNotesState({
notes: notes,
renderedNotes: notes.slice(0, this.notesToDisplay)
@@ -561,7 +556,6 @@ class NotesViewCtrl extends PureViewCtrl {
});
}
this.noteFlags[note.uuid] = flags;
return flags;
}
displayableNotes() {