diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index 57c0f46fad..6c6d8700a5 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -233,15 +233,12 @@ export default class RightPanel extends React.Component { const GroupRoomInfo = sdk.getComponent('groups.GroupRoomInfo'); let panel =
; + const roomId = this.props.room ? this.props.room.roomId : undefined; switch (this.state.phase) { case RightPanelPhases.RoomMemberList: - if (this.props.room.roomId) { - panel = ; + if (roomId) { + panel = ; } break; @@ -259,8 +256,8 @@ export default class RightPanel extends React.Component { case RightPanelPhases.EncryptionPanel: panel = ; + panel = ; break; case RightPanelPhases.GroupMemberInfo: @@ -292,10 +289,7 @@ export default class RightPanel extends React.Component { break; case RightPanelPhases.FilePanel: - panel = ; + panel = ; break; case RightPanelPhases.RoomSummary: diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 53769fb5a6..a20bf0dd0a 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -124,7 +124,11 @@ export default class LoginComponent extends React.Component { 'm.login.cas': () => this._renderSsoStep("cas"), 'm.login.sso': () => this._renderSsoStep("sso"), }; + } + // TODO: [REACT-WARNING] Replace with appropriate lifecycle event + // eslint-disable-next-line camelcase + UNSAFE_componentWillMount() { this._initLoginLogic(); } diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js index 84995aeb73..fc73c8b542 100644 --- a/src/components/views/right_panel/UserInfo.js +++ b/src/components/views/right_panel/UserInfo.js @@ -20,7 +20,7 @@ limitations under the License. import React, {useCallback, useMemo, useState, useEffect, useContext} from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import {Group, RoomMember, User} from 'matrix-js-sdk'; +import {Group, RoomMember, User, Room} from 'matrix-js-sdk'; import dis from '../../../dispatcher/dispatcher'; import Modal from '../../../Modal'; import * as sdk from '../../../index'; @@ -1463,11 +1463,9 @@ const UserInfoHeader = ({member, e2eStatus}) => { ; }; -const UserInfo = ({user, groupId, roomId, onClose, phase=RightPanelPhases.RoomMemberInfo, ...props}) => { +const UserInfo = ({user, groupId, room, onClose, phase=RightPanelPhases.RoomMemberInfo, ...props}) => { const cli = useContext(MatrixClientContext); - // Load room if we are given a room id and memoize it - this can be undefined for User Info/Group Member Info - const room = useMemo(() => roomId ? cli.getRoom(roomId) : null, [cli, roomId]); // fetch latest room member if we have a room, so we don't show historical information, falling back to user const member = useMemo(() => room ? (room.getMember(user.userId) || user) : user, [room, user]); @@ -1522,7 +1520,7 @@ UserInfo.propTypes = { ]).isRequired, group: PropTypes.instanceOf(Group), groupId: PropTypes.string, - roomId: PropTypes.string, + room: PropTypes.instanceOf(Room), onClose: PropTypes.func, };