From ffafbba5209270934e5e0717f04f7caf4f6447fc Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 12 Feb 2020 15:38:21 -0800 Subject: [PATCH] unread cards: Remove redundant loading indicator on session.loading. The loading indicator on an empty unread messages list during `session.loading` is redundant, following the introduction of LoadingBanner in this series of commits. Now, we can display the "No unread messages" text as our best guess at the current state, even though we know it's stale, since we're also displaying a loading indicator above. Fixes: #3387 Fixes: #3025 Fixes: #2725 --- src/unread/UnreadCards.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/unread/UnreadCards.js b/src/unread/UnreadCards.js index bd535c96250..352fd474ad1 100644 --- a/src/unread/UnreadCards.js +++ b/src/unread/UnreadCards.js @@ -5,13 +5,12 @@ import { SectionList } from 'react-native'; import type { Dispatch, PmConversationData, UnreadStreamItem, UserOrBot } from '../types'; import { connect } from '../react-redux'; -import { LoadingIndicator, SearchEmptyState } from '../common'; +import { SearchEmptyState } from '../common'; import PmConversationList from '../pm-conversations/PmConversationList'; import StreamItem from '../streams/StreamItem'; import TopicItem from '../streams/TopicItem'; import { streamNarrow, topicNarrow } from '../utils/narrow'; import { - getLoading, getUnreadConversations, getAllUsersByEmail, getUnreadStreamsAndTopicsSansMuted, @@ -21,7 +20,6 @@ import { doNarrow } from '../actions'; type Props = $ReadOnly<{| conversations: PmConversationData[], dispatch: Dispatch, - isLoading: boolean, usersByEmail: Map, unreadStreamsAndTopics: UnreadStreamItem[], |}>; @@ -36,7 +34,7 @@ class UnreadCards extends PureComponent { }; render() { - const { isLoading, conversations, unreadStreamsAndTopics, ...restProps } = this.props; + const { conversations, unreadStreamsAndTopics, ...restProps } = this.props; type Card = | UnreadStreamItem | { key: 'private', data: Array<$PropertyType> }; @@ -49,11 +47,7 @@ class UnreadCards extends PureComponent { ]; if (unreadStreamsAndTopics.length === 0 && conversations.length === 0) { - return isLoading ? ( - - ) : ( - - ); + return ; } return ( @@ -96,7 +90,6 @@ class UnreadCards extends PureComponent { } export default connect(state => ({ - isLoading: getLoading(state), conversations: getUnreadConversations(state), usersByEmail: getAllUsersByEmail(state), unreadStreamsAndTopics: getUnreadStreamsAndTopicsSansMuted(state),