make sure id exist (#22610)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
11002c9863
Коммит
3938717f60
@@ -388,7 +388,7 @@ export function makeGetPostsForThread(): (state: GlobalState, rootId: string) =>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The selector below filters current user if it exists. Excluding currentUser is just for convinience
|
// The selector below filters current user if it exists. Excluding currentUser is just for convenience
|
||||||
export function makeGetProfilesForThread(): (state: GlobalState, rootId: string) => UserProfile[] {
|
export function makeGetProfilesForThread(): (state: GlobalState, rootId: string) => UserProfile[] {
|
||||||
const getPostsForThread = makeGetPostsForThread();
|
const getPostsForThread = makeGetPostsForThread();
|
||||||
return createSelector(
|
return createSelector(
|
||||||
@@ -398,7 +398,7 @@ export function makeGetProfilesForThread(): (state: GlobalState, rootId: string)
|
|||||||
getPostsForThread,
|
getPostsForThread,
|
||||||
getUserStatuses,
|
getUserStatuses,
|
||||||
(allUsers, currentUserId, posts, userStatuses) => {
|
(allUsers, currentUserId, posts, userStatuses) => {
|
||||||
const profileIds = posts.map((post) => post.user_id);
|
const profileIds = posts.map((post) => post.user_id).filter(Boolean);
|
||||||
const uniqueIds = [...new Set(profileIds)];
|
const uniqueIds = [...new Set(profileIds)];
|
||||||
return uniqueIds.reduce((acc: UserProfile[], id: string) => {
|
return uniqueIds.reduce((acc: UserProfile[], id: string) => {
|
||||||
const profile: UserProfile = userStatuses ? {...allUsers[id], status: userStatuses[id]} : {...allUsers[id]};
|
const profile: UserProfile = userStatuses ? {...allUsers[id], status: userStatuses[id]} : {...allUsers[id]};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user