fix edge cases around space panel auto collapsing/closing menu

This commit is contained in:
Michael Telatynski 2021-05-27 09:11:43 +01:00
parent 818dfc91ec
commit bd653ac5a8

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}
/>