diff --git a/app/views/RoomsListView/index.tsx b/app/views/RoomsListView/index.tsx index e80778317..d253ddea2 100644 --- a/app/views/RoomsListView/index.tsx +++ b/app/views/RoomsListView/index.tsx @@ -197,6 +197,52 @@ class RoomsListView extends React.Component, nextState: Readonly): boolean { + const { + createTeamPermission, + createPublicChannelPermission, + createPrivateChannelPermission, + createDirectMessagePermission, + createDiscussionPermission + } = this.props; + if ( + !dequal(createTeamPermission, nextProps.createTeamPermission) || + !dequal(createPublicChannelPermission, nextProps.createPublicChannelPermission) || + !dequal(createPrivateChannelPermission, nextProps.createPrivateChannelPermission) || + !dequal(createDirectMessagePermission, nextProps.createDirectMessagePermission) || + !dequal(createDiscussionPermission, nextProps.createDiscussionPermission) + ) { + return true; + } + + const { chats, search } = this.state; + if (!dequal(chats, nextState.chats) || !dequal(search, nextState.search)) { + return true; + } + + const { sortBy, groupByType, showFavorites, showUnread, subscribedRoom, isMasterDetail, showAvatar, displayMode } = + this.props; + if ( + sortBy !== nextProps.sortBy || + groupByType !== nextProps.groupByType || + showFavorites !== nextProps.showFavorites || + showUnread !== nextProps.showUnread || + showAvatar !== nextProps.showAvatar || + displayMode !== nextProps.displayMode || + subscribedRoom !== nextProps.subscribedRoom || + isMasterDetail !== nextProps.isMasterDetail + ) { + return true; + } + + const { searching, loading, canCreateRoom } = this.state; + if (searching !== nextState.searching || loading !== nextState.loading || canCreateRoom !== nextState.canCreateRoom) { + return true; + } + + return false; + } + componentDidUpdate(prevProps: IRoomsListViewProps) { const { sortBy,