Skip to content

Commit 40e7fa9

Browse files
author
Chris Bobbe
committed
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: #3025
1 parent 5fcc983 commit 40e7fa9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/unread/UnreadCards.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import { SectionList } from 'react-native';
55

66
import type { Dispatch, PmConversationData, UnreadStreamItem, UserOrBot } from '../types';
77
import { connect } from '../react-redux';
8-
import { LoadingIndicator, SearchEmptyState } from '../common';
8+
import { SearchEmptyState } from '../common';
99
import PmConversationList from '../pm-conversations/PmConversationList';
1010
import StreamItem from '../streams/StreamItem';
1111
import TopicItem from '../streams/TopicItem';
1212
import { streamNarrow, topicNarrow } from '../utils/narrow';
1313
import {
14-
getLoading,
1514
getUnreadConversations,
1615
getAllUsersByEmail,
1716
getUnreadStreamsAndTopicsSansMuted,
@@ -21,7 +20,6 @@ import { doNarrow } from '../actions';
2120
type Props = $ReadOnly<{|
2221
conversations: PmConversationData[],
2322
dispatch: Dispatch,
24-
isLoading: boolean,
2523
usersByEmail: Map<string, UserOrBot>,
2624
unreadStreamsAndTopics: UnreadStreamItem[],
2725
|}>;
@@ -36,7 +34,7 @@ class UnreadCards extends PureComponent<Props> {
3634
};
3735

3836
render() {
39-
const { isLoading, conversations, unreadStreamsAndTopics, ...restProps } = this.props;
37+
const { conversations, unreadStreamsAndTopics, ...restProps } = this.props;
4038
type Card =
4139
| UnreadStreamItem
4240
| { key: 'private', data: Array<$PropertyType<PmConversationList, 'props'>> };
@@ -49,11 +47,7 @@ class UnreadCards extends PureComponent<Props> {
4947
];
5048

5149
if (unreadStreamsAndTopics.length === 0 && conversations.length === 0) {
52-
return isLoading ? (
53-
<LoadingIndicator size={40} />
54-
) : (
55-
<SearchEmptyState text="No unread messages" />
56-
);
50+
return <SearchEmptyState text="No unread messages" />;
5751
}
5852

5953
return (
@@ -96,7 +90,6 @@ class UnreadCards extends PureComponent<Props> {
9690
}
9791

9892
export default connect(state => ({
99-
isLoading: getLoading(state),
10093
conversations: getUnreadConversations(state),
10194
usersByEmail: getAllUsersByEmail(state),
10295
unreadStreamsAndTopics: getUnreadStreamsAndTopicsSansMuted(state),

0 commit comments

Comments
 (0)