File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { createStyleSheet } from '../styles';
6
6
import UserAvatar from './UserAvatar' ;
7
7
import PresenceStatusIndicator from './PresenceStatusIndicator' ;
8
8
import { AvatarURL } from '../utils/avatar' ;
9
- import { getUserForId } from '../users/userSelectors' ;
9
+ import { tryGetUserForId } from '../users/userSelectors' ;
10
10
import { useSelector } from '../react-redux' ;
11
11
12
12
const styles = createStyleSheet ( {
@@ -70,6 +70,14 @@ export function UserAvatarWithPresenceById(
70
70
| } > ,
71
71
) {
72
72
const { userId , ...restProps } = props ;
73
- const user = useSelector ( state => getUserForId ( state , userId ) ) ;
73
+
74
+ const user = useSelector ( state => tryGetUserForId ( state , userId ) ) ;
75
+ if ( ! user ) {
76
+ // This condition really does happen, because UserItem can be passed a fake
77
+ // pseudo-user by PeopleAutocomplete, to represent `@all` or `@everyone`.
78
+ // TODO eliminate that, and use plain `getUserForId` here.
79
+ return null ;
80
+ }
81
+
74
82
return < UserAvatarWithPresence { ...restProps } avatarUrl = { user . avatar_url } email = { user . email } /> ;
75
83
}
You can’t perform that action at this time.
0 commit comments