Management / Add Member: Fix exception

This commit is contained in:
Alexander Zinchuk 2022-03-05 18:06:15 +01:00
parent 139bc84174
commit e679b6ae7e

View File

@ -953,12 +953,16 @@ addReducer('loadMoreMembers', (global) => {
global = getGlobal();
global = addUsers(global, buildCollectionByKey(users, 'id'));
const newMemberIds = new Set(members.map(m => m.userId));
const preservedMembers = chat.fullInfo?.members?.filter((m) => !newMemberIds.has(m.userId)) || [];
global = updateChat(global, chat.id, {
fullInfo: {
...chat.fullInfo,
members: [
...((chat.fullInfo || {}).members || []),
...(members || []),
...preservedMembers,
...members,
],
},
});