From 27de8c1f840dff43a3380c3d5909257137b813b2 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 5 Jun 2019 10:39:12 -0300 Subject: [PATCH] [REGRESSION] Get rooms on app restore (#958) --- app/views/RoomsListView/index.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 62c7ce1bb..d3574c339 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -19,8 +19,8 @@ import ServerDropdown from './ServerDropdown'; import { toggleSortDropdown as toggleSortDropdownAction, openSearchHeader as openSearchHeaderAction, - closeSearchHeader as closeSearchHeaderAction - // roomsRequest as roomsRequestAction + closeSearchHeader as closeSearchHeaderAction, + roomsRequest as roomsRequestAction } from '../../actions/rooms'; import { appStart as appStartAction } from '../../actions'; import debounce from '../../utils/debounce'; @@ -55,8 +55,8 @@ const keyExtractor = item => item.rid; toggleSortDropdown: () => dispatch(toggleSortDropdownAction()), openSearchHeader: () => dispatch(openSearchHeaderAction()), closeSearchHeader: () => dispatch(closeSearchHeaderAction()), - appStart: () => dispatch(appStartAction()) - // roomsRequest: () => dispatch(roomsRequestAction()) + appStart: () => dispatch(appStartAction()), + roomsRequest: () => dispatch(roomsRequestAction()) })) export default class RoomsListView extends React.Component { static navigationOptions = ({ navigation }) => { @@ -104,12 +104,12 @@ export default class RoomsListView extends React.Component { showUnread: PropTypes.bool, useRealName: PropTypes.bool, StoreLastMessage: PropTypes.bool, - // appState: PropTypes.string, + appState: PropTypes.string, toggleSortDropdown: PropTypes.func, openSearchHeader: PropTypes.func, closeSearchHeader: PropTypes.func, - appStart: PropTypes.func - // roomsRequest: PropTypes.func + appStart: PropTypes.func, + roomsRequest: PropTypes.func } constructor(props) { @@ -185,7 +185,7 @@ export default class RoomsListView extends React.Component { componentDidUpdate(prevProps) { const { - sortBy, groupByType, showFavorites, showUnread + sortBy, groupByType, showFavorites, showUnread, appState, roomsRequest } = this.props; if (!( @@ -195,11 +195,9 @@ export default class RoomsListView extends React.Component { && (prevProps.showUnread === showUnread) )) { this.getSubscriptions(); + } else if (appState === 'foreground' && appState !== prevProps.appState) { + roomsRequest(); } - // removed for now... we may not need it anymore - // else if (appState === 'foreground' && appState !== prevProps.appState) { - // // roomsRequest(); - // } } componentWillUnmount() {