Fixes smart tags, toggling archive, and toggling trashed

This commit is contained in:
Mo Bitar
2020-04-17 09:28:58 -05:00
parent 4451832c9e
commit 2083ce763f
7 changed files with 255 additions and 147 deletions

View File

@@ -138,7 +138,6 @@ class NotesViewCtrl extends PureViewCtrl {
this.handleEditorChange();
} else if (eventName === AppStateEvent.PreferencesChanged) {
this.reloadPreferences();
this.reloadNotes();
} else if (eventName === AppStateEvent.EditorFocused) {
this.setShowMenuFalse();
}
@@ -283,12 +282,12 @@ class NotesViewCtrl extends PureViewCtrl {
});
}
async reloadNotes() {
private async reloadNotes() {
this.reloadNotesPromise = this.performPeloadNotes();
return this.reloadNotesPromise;
}
async performPeloadNotes() {
private async performPeloadNotes() {
const tag = this.appState.selectedTag!;
if (!tag) {
return;
@@ -336,7 +335,7 @@ class NotesViewCtrl extends PureViewCtrl {
}
}
reloadPreferences() {
async reloadPreferences() {
const viewOptions = {} as NotesState;
const prevSortValue = this.getState().sortBy;
let sortBy = this.application!.getPrefsService().getValue(
@@ -372,12 +371,9 @@ class NotesViewCtrl extends PureViewCtrl {
WebPrefKey.NotesHideTags,
false
);
this.setNotesState({
await this.setNotesState({
...viewOptions
});
if (prevSortValue && prevSortValue !== sortBy) {
this.selectFirstNote();
}
const width = this.application!.getPrefsService().getValue(
WebPrefKey.NotesPanelWidth
);
@@ -390,6 +386,10 @@ class NotesViewCtrl extends PureViewCtrl {
);
}
}
await this.reloadNotes();
if (prevSortValue && prevSortValue !== sortBy) {
this.selectFirstNote();
}
}
onPanelResize(