Correctly handle defaults

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-05-05 11:48:55 +02:00
parent 791f39abcc
commit 2044ff0149
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 2 additions and 1 deletions

View File

@ -70,9 +70,10 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
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,