diff --git a/app/screens/channel_add_members/channel_add_members.js b/app/screens/channel_add_members/channel_add_members.js index 42ebb9cde..64e5a2bcb 100644 --- a/app/screens/channel_add_members/channel_add_members.js +++ b/app/screens/channel_add_members/channel_add_members.js @@ -63,6 +63,7 @@ class ChannelAddMembers extends PureComponent { selectedMembers: {}, showNoResults: false, term: '', + isLoading: true, }; this.addButton.title = props.intl.formatMessage({id: 'integrations.add', defaultMessage: 'Add'}); @@ -123,6 +124,12 @@ class ChannelAddMembers extends PureComponent { break; } } + + if ((loadMoreRequestStatus !== nextProps.loadMoreRequestStatus) || (this.props.searchRequestStatus !== nextProps.searchRequestStatus)) { + const isLoading = (nextProps.loadMoreRequestStatus === RequestStatus.STARTED) || + (nextProps.searchRequestStatus === RequestStatus.STARTED); + this.setState({isLoading}); + } } cancelSearch = () => { @@ -222,11 +229,9 @@ class ChannelAddMembers extends PureComponent { }; render() { - const {intl, loadMoreRequestStatus, searchRequestStatus, preferences, theme} = this.props; + const {intl, preferences, theme} = this.props; const {adding, profiles, searching, term} = this.state; const {formatMessage} = intl; - const isLoading = (loadMoreRequestStatus === RequestStatus.STARTED) || - (searchRequestStatus === RequestStatus.STARTED); const style = getStyleFromTheme(theme); const more = searching ? () => true : this.loadMoreMembers; @@ -281,12 +286,13 @@ class ChannelAddMembers extends PureComponent { onListEndReached={more} preferences={preferences} listScrollRenderAheadDistance={50} - loading={isLoading} + loading={this.state.isLoading} loadingText={loadingText} selectable={this.state.canSelect} onRowSelect={this.handleRowSelect} renderRow={UserListRow} createSections={createMembersSections} + showNoResults={this.state.showNoResults} /> );