From 1501238730a338b78d8396f06baba4318374336d Mon Sep 17 00:00:00 2001 From: Apoorva Shukla Date: Sat, 24 Apr 2021 22:00:07 +0530 Subject: [PATCH] Desktop: Resolves #4736: Note list is empty if search field is cleared (#4739) --- packages/app-desktop/gui/SearchBar/SearchBar.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/app-desktop/gui/SearchBar/SearchBar.tsx b/packages/app-desktop/gui/SearchBar/SearchBar.tsx index 232b324b2..b90609153 100644 --- a/packages/app-desktop/gui/SearchBar/SearchBar.tsx +++ b/packages/app-desktop/gui/SearchBar/SearchBar.tsx @@ -80,6 +80,11 @@ function SearchBar(props: Props) { }, [props.selectedNoteId]); function onChange(event: any) { + if (event.value.length === 0) { + // Revert to previous state if query string becomes empty + void onExitSearch(); + return; + } setSearchStarted(true); setQuery(event.value); }