From 2044ff01493d3bf9944d596aae5d6066936e4a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 5 May 2021 11:48:55 +0200 Subject: [PATCH] Correctly handle defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/spaces/SpaceTreeLevel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/spaces/SpaceTreeLevel.tsx b/src/components/views/spaces/SpaceTreeLevel.tsx index 6e00eac725..47ed0cd6ca 100644 --- a/src/components/views/spaces/SpaceTreeLevel.tsx +++ b/src/components/views/spaces/SpaceTreeLevel.tsx @@ -70,9 +70,10 @@ export class SpaceItem extends React.PureComponent { constructor(props) { super(props); + const collapsedLocalStorage = localStorage.getItem(getSpaceCollapsedKey(props.space)); // XXX: localStorage doesn't allow booleans // default to collapsed for root items - const collapsed = localStorage.getItem(getSpaceCollapsedKey(props.space)) === "true" || !props.isNested; + const collapsed = collapsedLocalStorage ? collapsedLocalStorage === "true" : !props.isNested; this.state = { collapsed: collapsed,