diff --git a/src/components/views/spaces/SpaceTreeLevel.tsx b/src/components/views/spaces/SpaceTreeLevel.tsx index 399c137e97..3561fd19bf 100644 --- a/src/components/views/spaces/SpaceTreeLevel.tsx +++ b/src/components/views/spaces/SpaceTreeLevel.tsx @@ -270,8 +270,10 @@ export class SpaceItem extends React.PureComponent { ? StaticNotificationState.forSymbol("!", NotificationColor.Red) : SpaceStore.instance.getNotificationState(space.roomId); + const hasChildren = this.state.childSpaces?.length; + let childItems; - if (this.state.childSpaces?.length && !collapsed) { + if (hasChildren && !collapsed) { childItems = { />; } - const toggleCollapseButton = this.state.childSpaces?.length ? + const toggleCollapseButton = hasChildren ? { /> : null; return ( -
  • +