From 5f4ca63148d983a7a08a76085eb0613565f9162e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 13 Feb 2023 03:32:30 +0100 Subject: [PATCH] Left Column: Fix auto-hide on tablet layout (#2562) --- src/components/main/Main.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/main/Main.tsx b/src/components/main/Main.tsx index 4835bc49f..cb32684ff 100644 --- a/src/components/main/Main.tsx +++ b/src/components/main/Main.tsx @@ -222,15 +222,16 @@ const Main: FC = ({ console.log('>>> RENDER MAIN'); } - // If you open the chat in the mobile version, switch to the desktop version, close the chat and - // switch back to the mobile version, you get a blank screen const { isDesktop } = useAppLayout(); useEffect(() => { - const areColumnsConflicting = isLeftColumnOpen === isMiddleColumnOpen; - if (areColumnsConflicting && !isDesktop) { + if (!isLeftColumnOpen && !isMiddleColumnOpen && !isDesktop) { + // Always display at least one column + toggleLeftColumn(); + } else if (isLeftColumnOpen && isMiddleColumnOpen && isMobile) { + // Can't have two active columns at the same time toggleLeftColumn(); } - }, [isDesktop, isLeftColumnOpen, isMiddleColumnOpen, toggleLeftColumn]); + }, [isDesktop, isLeftColumnOpen, isMiddleColumnOpen, isMobile, toggleLeftColumn]); useInterval(checkAppVersion, isMasterTab ? APP_OUTDATED_TIMEOUT_MS : undefined, true);