From c6e8f0a68d44f6b7f05646e34d37551e6b99d946 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 12 Apr 2022 12:10:49 +0100 Subject: [PATCH] Tidy --- src/components/views/rooms/RoomListHeader.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/RoomListHeader.tsx b/src/components/views/rooms/RoomListHeader.tsx index 076a6b483d4..6a892df2386 100644 --- a/src/components/views/rooms/RoomListHeader.tsx +++ b/src/components/views/rooms/RoomListHeader.tsx @@ -140,12 +140,14 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { } }); + const canShowMainMenu = activeSpace || spaceKey === MetaSpace.Home; + useEffect(() => { - if (mainMenuDisplayed && !activeSpace && spaceKey !== MetaSpace.Home) { + if (mainMenuDisplayed && !canShowMainMenu) { // Space changed under us and we no longer has a main menu to draw closeMainMenu(); } - }, [closeMainMenu, activeSpace, spaceKey, mainMenuDisplayed]); + }, [closeMainMenu, canShowMainMenu, mainMenuDisplayed]); // we pass null for the queryLength to inhibit the metrics hook for when there is no filterCondition useWebSearchMetrics(count, filterCondition ? filterCondition.search.length : null, false); @@ -371,7 +373,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { .join("\n"); let contextMenuButton: JSX.Element =