From 431098b56b2f551285be9eac004a7fc63308b8b0 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Mon, 15 Nov 2021 12:49:34 +0100 Subject: [PATCH] Fixes element not remembering widget hidden state per room (#7136) --- src/components/structures/RoomView.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index d6ec1ca980..3385af8ac4 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -583,15 +583,15 @@ export class RoomView extends React.Component { // Check if user has previously chosen to hide the app drawer for this // room. If so, do not show apps - const hideWidgetDrawer = localStorage.getItem( - room.roomId + "_hide_widget_drawer"); + const hideWidgetKey = room.roomId + "_hide_widget_drawer"; + const hideWidgetDrawer = localStorage.getItem(hideWidgetKey); - // This is confusing, but it means to say that we default to the tray being - // hidden unless the user clicked to open it. - const isManuallyShown = hideWidgetDrawer === "false"; + // If unset show the Tray + // Otherwise (in case the user set hideWidgetDrawer by clicking the button) follow the parameter. + const isManuallyShown = hideWidgetDrawer ? hideWidgetDrawer === "false": true; const widgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top); - return widgets.length > 0 || isManuallyShown; + return isManuallyShown && widgets.length > 0; } componentDidMount() {