From 53f1129242ee6fee6cbf6add12daed39965a7478 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sun, 24 Apr 2022 16:35:42 +0530 Subject: [PATCH] Fix app stuck on welcome screen in small device --- src/app/organisms/invite-list/InviteList.jsx | 3 +-- src/app/organisms/room/Room.jsx | 6 ++++- src/app/organisms/room/RoomSettings.jsx | 3 +-- src/app/organisms/room/RoomViewCmdBar.jsx | 2 -- src/app/organisms/room/RoomViewHeader.jsx | 6 ++--- src/app/templates/client/Client.jsx | 23 +++++--------------- src/client/action/navigation.js | 4 +--- 7 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/app/organisms/invite-list/InviteList.jsx b/src/app/organisms/invite-list/InviteList.jsx index 03a94d69..65920704 100644 --- a/src/app/organisms/invite-list/InviteList.jsx +++ b/src/app/organisms/invite-list/InviteList.jsx @@ -5,7 +5,7 @@ import './InviteList.scss'; import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; import * as roomActions from '../../../client/action/room'; -import { selectRoom, selectTab, openNavigation } from '../../../client/action/navigation'; +import { selectRoom, selectTab } from '../../../client/action/navigation'; import Text from '../../atoms/text/Text'; import Button from '../../atoms/button/Button'; @@ -28,7 +28,6 @@ function InviteList({ isOpen, onRequestClose }) { procInvite.add(roomId); changeProcInvite(new Set(Array.from(procInvite))); roomActions.leave(roomId, isDM); - openNavigation(); } function updateInviteList(roomId) { if (procInvite.has(roomId)) procInvite.delete(roomId); diff --git a/src/app/organisms/room/Room.jsx b/src/app/organisms/room/Room.jsx index 4a1a969d..447686af 100644 --- a/src/app/organisms/room/Room.jsx +++ b/src/app/organisms/room/Room.jsx @@ -6,6 +6,7 @@ import cons from '../../../client/state/cons'; import settings from '../../../client/state/settings'; import RoomTimeline from '../../../client/state/RoomTimeline'; import navigation from '../../../client/state/navigation'; +import { openNavigation } from '../../../client/action/navigation'; import Welcome from '../welcome/Welcome'; import RoomView from './RoomView'; @@ -53,7 +54,10 @@ function Room() { }, []); const { roomTimeline, eventId } = roomInfo; - if (roomTimeline === null) return ; + if (roomTimeline === null) { + setTimeout(() => openNavigation()); + return ; + } return (
diff --git a/src/app/organisms/room/RoomSettings.jsx b/src/app/organisms/room/RoomSettings.jsx index b75ca7fc..8d14c18d 100644 --- a/src/app/organisms/room/RoomSettings.jsx +++ b/src/app/organisms/room/RoomSettings.jsx @@ -7,7 +7,7 @@ import { blurOnBubbling } from '../../atoms/button/script'; import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; import navigation from '../../../client/state/navigation'; -import { openInviteUser, toggleRoomSettings, openNavigation } from '../../../client/action/navigation'; +import { openInviteUser, toggleRoomSettings } from '../../../client/action/navigation'; import * as roomActions from '../../../client/action/room'; import Text from '../../atoms/text/Text'; @@ -88,7 +88,6 @@ function GeneralSettings({ roomId }) { onClick={() => { if (confirm('Are you sure that you want to leave this room?')) { roomActions.leave(roomId); - openNavigation(); } }} iconSrc={LeaveArrowIC} diff --git a/src/app/organisms/room/RoomViewCmdBar.jsx b/src/app/organisms/room/RoomViewCmdBar.jsx index a20afdb7..5bbc0aae 100644 --- a/src/app/organisms/room/RoomViewCmdBar.jsx +++ b/src/app/organisms/room/RoomViewCmdBar.jsx @@ -14,7 +14,6 @@ import { openCreateRoom, openPublicRooms, openInviteUser, - openNavigation, } from '../../../client/action/navigation'; import { getEmojiForCompletion } from '../emoji-board/custom-emoji'; import AsyncSearch from '../../../util/AsyncSearch'; @@ -47,7 +46,6 @@ const commands = [{ description: 'Leave current room', exe: (roomId) => { roomActions.leave(roomId); - openNavigation(); }, }, { name: 'invite', diff --git a/src/app/organisms/room/RoomViewHeader.jsx b/src/app/organisms/room/RoomViewHeader.jsx index db1df9d8..a4915ad5 100644 --- a/src/app/organisms/room/RoomViewHeader.jsx +++ b/src/app/organisms/room/RoomViewHeader.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import './RoomViewHeader.scss'; @@ -8,7 +8,7 @@ import { blurOnBubbling } from '../../atoms/button/script'; import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; import navigation from '../../../client/state/navigation'; -import { toggleRoomSettings, openReusableContextMenu } from '../../../client/action/navigation'; +import { toggleRoomSettings, openReusableContextMenu, openNavigation } from '../../../client/action/navigation'; import { togglePeopleDrawer } from '../../../client/action/settings'; import colorMXID from '../../../util/colorMXID'; import { getEventCords } from '../../../util/common'; @@ -78,7 +78,7 @@ function RoomViewHeader({ roomId }) { src={BackArrowIC} className="room-header__back-btn" tooltip="Return to navigation" - onClick={() => navigation.emit(cons.events.navigation.NAVIGATION_OPENED)} + onClick={() => openNavigation()} />