Skip to content

Commit 41f347c

Browse files
committed
PresenceStatusIndicator [nfc]: Call getUserStatus with userId from props
1 parent 1cd86f8 commit 41f347c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/common/PresenceStatusIndicator.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { useContext } from 'react';
33
import type { Node } from 'react';
44
import { View } from 'react-native';
55
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
6-
import invariant from 'invariant';
76

87
import { createStyleSheet, ThemeContext } from '../styles';
98
import { useSelector } from '../react-redux';
@@ -131,17 +130,12 @@ export default function PresenceStatusIndicator(props: Props): Node {
131130
const user = useSelector(state => tryGetUserForId(state, userId));
132131
const userPresence = (user && (presence[user.email]: UserPresence | void)) ?? null;
133132

134-
const userStatus = useSelector(state => user && getUserStatus(state, user.user_id));
133+
const userStatus = useSelector(state => getUserStatus(state, userId));
135134

136135
if (!user || !userPresence || !userPresence.aggregated) {
137136
return null;
138137
}
139138

140-
invariant(
141-
userStatus,
142-
'`userStatus` only missing if `user` is missing, but `user` is not missing here (see early return)`',
143-
);
144-
145139
const status = statusFromPresenceAndUserStatus(userPresence, userStatus);
146140

147141
if (hideIfOffline && status === 'offline') {

0 commit comments

Comments
 (0)