fix edge cases around space panel auto collapsing/closing menu

pull/21833/head
Michael Telatynski 2021-05-27 09:11:43 +01:00
parent 818dfc91ec
commit bd653ac5a8
1 changed files with 4 additions and 2 deletions

View File

@ -128,7 +128,9 @@ const SpacePanel = () => {
const [isPanelCollapsed, setPanelCollapsed] = useState(true);
useEffect(() => {
closeMenu();
if (!isPanelCollapsed && menuDisplayed) {
closeMenu();
}
}, [isPanelCollapsed]); // eslint-disable-line react-hooks/exhaustive-deps
const newClasses = classNames("mx_SpaceButton_new", {
@ -239,8 +241,8 @@ const SpacePanel = () => {
className={newClasses}
tooltip={menuDisplayed ? _t("Cancel") : _t("Create a space")}
onClick={menuDisplayed ? closeMenu : () => {
openMenu();
if (!isPanelCollapsed) setPanelCollapsed(true);
openMenu();
}}
isNarrow={isPanelCollapsed}
/>