diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -126,12 +126,30 @@ return relativeMemberInfos; } -const emptyArray: $ReadOnlyArray = []; +function getRelativeMemberInfos( + threadInfo: ?MinimallyEncodedRawThreadInfo | LegacyRawThreadInfo, + currentUserID: ?string, + userInfos: UserInfos, +): $ReadOnlyArray< + MinimallyEncodedRelativeMemberInfo | LegacyRelativeMemberInfo, +> { + if (threadInfo?.minimallyEncoded) { + return getMinimallyEncodedRelativeMemberInfos( + threadInfo, + currentUserID, + userInfos, + ); + } else { + return getLegacyRelativeMemberInfos(threadInfo, currentUserID, userInfos); + } +} + +const emptyArray: $ReadOnlyArray = []; // Includes current user at the start const baseRelativeMemberInfoSelectorForMembersOfThread: ( threadID: ?string, -) => (state: BaseAppState<>) => $ReadOnlyArray = ( +) => (state: BaseAppState<>) => $ReadOnlyArray = ( threadID: ?string, ) => { if (!threadID) { @@ -142,7 +160,7 @@ (state: BaseAppState<>) => state.currentUserInfo && state.currentUserInfo.id, (state: BaseAppState<>) => state.userStore.userInfos, - getLegacyRelativeMemberInfos, + getRelativeMemberInfos, ); }; @@ -279,6 +297,7 @@ export { userIDsToRelativeUserInfos, + getRelativeMemberInfos, getMinimallyEncodedRelativeMemberInfos, getLegacyRelativeMemberInfos, relativeMemberInfoSelectorForMembersOfThread,