Desktop: Fixes #6557: Search field would not clear as expected

pull/6577/head
Laurent Cozic 2022-06-14 14:24:51 +01:00
parent c7697b65ca
commit 176c9e0bcf
1 changed files with 2 additions and 4 deletions

View File

@ -119,9 +119,7 @@ function SearchBar(props: Props) {
}, [onExitSearch]);
const onSearchButtonClick = useCallback(() => {
console.info('isFocused', props.isFocused);
if (props.isFocused) {
if (props.isFocused || searchStarted) {
void onExitSearch();
} else {
setSearchStarted(true);
@ -131,7 +129,7 @@ function SearchBar(props: Props) {
field: 'globalSearch',
});
}
}, [onExitSearch, props.isFocused]);
}, [onExitSearch, props.isFocused, searchStarted]);
useEffect(() => {
if (props.notesParentType !== 'Search') {