Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Apr 12, 2022
1 parent cc15cd6 commit c6e8f0a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/views/rooms/RoomListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -371,7 +373,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => {
.join("\n");

let contextMenuButton: JSX.Element = <div className="mx_RoomListHeader_contextLessTitle">{ title }</div>;
if (activeSpace || spaceKey === MetaSpace.Home) {
if (canShowMainMenu) {
contextMenuButton = <ContextMenuTooltipButton
inputRef={mainMenuHandle}
onClick={openMainMenu}
Expand Down

0 comments on commit c6e8f0a

Please sign in to comment.