From 93f8d6bbe771dd6eca099638eb45d2e1f20e8951 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Thu, 11 Mar 2021 15:07:39 +0100 Subject: [PATCH] refactor: use setState --- app/assets/javascripts/views/notes/notes_view.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index 9d71f391b..5eee017f7 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -706,7 +706,12 @@ class NotesViewCtrl extends PureViewCtrl { 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 { }); 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(); }