From 7088be01c8a9765f7569fd66e12a7ff61fd19287 Mon Sep 17 00:00:00 2001 From: asrient <44570278+asrient@users.noreply.github.com> Date: Sat, 15 Jan 2022 22:35:31 +0530 Subject: [PATCH] Desktop: Fixes #5953: Note list buttons do not reappear after changing app layout (#5994) --- packages/app-desktop/gui/SearchBar/SearchBar.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/app-desktop/gui/SearchBar/SearchBar.tsx b/packages/app-desktop/gui/SearchBar/SearchBar.tsx index 2a66638850..8917a4075d 100644 --- a/packages/app-desktop/gui/SearchBar/SearchBar.tsx +++ b/packages/app-desktop/gui/SearchBar/SearchBar.tsx @@ -139,6 +139,21 @@ function SearchBar(props: Props) { } }, [props.notesParentType, onExitSearch]); + // When the searchbar is remounted, exit the search if it was previously open + // or else other buttons stay hidden (e.g. when opening Layout Editor and closing it) + // https://github.com/laurent22/joplin/issues/5953 + useEffect(() => { + if (props.notesParentType === 'Search' || props.isFocused) { + if (props.isFocused) { + props.dispatch({ + type: 'FOCUS_CLEAR', + field: 'globalSearch', + }); + } + void onExitSearch(true); + } + }, []); + return (