Skip to content

Commit f8bf992

Browse files
committed
unread [nfc]: Reuse getUnreadCountForTopic in an unread selector, too.
Now this spot where we look into the details of the unreads data structure is encapsulated inside the unreads model.
1 parent b25a3ef commit f8bf992

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/unread/unreadSelectors.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
getUnreadHuddles,
1717
getUnreadMentions,
1818
getUnreadStreams,
19+
getUnreadCountForTopic,
1920
} from './unreadModel';
2021

2122
/** The number of unreads in each stream, excluding muted topics, by stream ID. */
@@ -251,7 +252,7 @@ export const getUnreadCountForNarrow: Selector<number, Narrow> = createSelector(
251252
if (!stream) {
252253
return 0;
253254
}
254-
return unread.streams.get(stream.stream_id)?.get(topic)?.size ?? 0;
255+
return getUnreadCountForTopic(unread, stream.stream_id, topic);
255256
},
256257

257258
pm: ids => {

0 commit comments

Comments
 (0)