refactor: use setState

This commit is contained in:
Baptiste Grob
2021-03-11 15:07:39 +01:00
parent eb0d7f65bd
commit 93f8d6bbe7

View File

@@ -706,7 +706,12 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
async onIncludeProtectedNoteTextChange(event: Event) {
this.searchBarInput?.[0].focus();
if (this.state.noteFilter.includeProtectedNoteText) {
this.state.noteFilter.includeProtectedNoteText = false;
await this.setState({
noteFilter: {
...this.state.noteFilter,
includeProtectedNoteText: false,
},
});
this.reloadNotesDisplayOptions();
await this.reloadNotes();
} else {
@@ -715,7 +720,12 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
});
event.preventDefault();
if (await this.application.authorizeSearchingProtectedNotesText()) {
this.state.noteFilter.includeProtectedNoteText = true;
await this.setState({
noteFilter: {
...this.state.noteFilter,
includeProtectedNoteText: true,
},
});
this.reloadNotesDisplayOptions();
await this.reloadNotes();
}