[Perf] [Refactoring] Fix incorrect parsing of object conditional properties

This commit is contained in:
Alexander Zinchuk 2021-08-03 19:03:17 +03:00
parent a9eaa1a6d4
commit 5d6a0305b2
6 changed files with 14 additions and 14 deletions

View File

@ -344,10 +344,7 @@ export default memo(withGlobal<OwnProps>(
chat,
isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),
lastMessageSender,
...(isOutgoing && { lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage) }),
...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),
actionTargetUserIds,
...(actionTargetUserIds && { usersById }),
actionTargetChatId,
actionTargetMessage,
draft: selectDraft(global, chatId, MAIN_THREAD_ID),
@ -355,6 +352,9 @@ export default memo(withGlobal<OwnProps>(
isSelected,
canScrollDown: isSelected && messageListType === 'thread',
lastSyncTime: global.lastSyncTime,
...(isOutgoing && { lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage) }),
...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),
...(actionTargetUserIds && { usersById }),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [

View File

@ -231,14 +231,14 @@ export default memo(withGlobal<OwnProps>(
chatsById,
usersById,
lastSyncTime,
notifySettings: selectNotifySettings(global),
notifyExceptions: selectNotifyExceptions(global),
...(listType ? {
listIds: listIds[listType],
orderedPinnedIds: orderedPinnedIds[listType],
} : {
chatFolder,
}),
notifySettings: selectNotifySettings(global),
notifyExceptions: selectNotifyExceptions(global),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [

View File

@ -137,8 +137,8 @@ export default memo(withGlobal<OwnProps>(
return {
chat,
...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),
lastSyncTime: global.lastSyncTime,
...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [

View File

@ -534,12 +534,12 @@ export default memo(withGlobal<OwnProps>(
focusingId,
hasFocusHighlight,
isSelectModeActive: selectIsInSelectMode(global),
...(withLastMessageWhenPreloading && { lastMessage }),
botDescription,
threadTopMessageId,
hasLinkedChat: chat.fullInfo && ('linkedChatId' in chat.fullInfo)
? Boolean(chat.fullInfo.linkedChatId)
: undefined,
...(withLastMessageWhenPreloading && { lastMessage }),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [

View File

@ -968,10 +968,7 @@ export default memo(withGlobal<OwnProps>(
isThreadTop,
replyMessage,
replyMessageSender,
...(isOutgoing && { outgoingStatus: selectOutgoingStatus(global, message, messageListType === 'scheduled') }),
...(typeof uploadProgress === 'number' && { uploadProgress }),
isFocused,
...(isFocused && { focusDirection, noFocusHighlight }),
isForwarding,
isChatWithSelf,
isChannel,
@ -989,6 +986,9 @@ export default memo(withGlobal<OwnProps>(
shouldAutoLoadMedia: chat ? selectShouldAutoLoadMedia(global, message, chat, sender) : undefined,
shouldAutoPlayMedia: selectShouldAutoPlayMedia(global, message),
shouldLoopStickers: selectShouldLoopStickers(global),
...(isOutgoing && { outgoingStatus: selectOutgoingStatus(global, message, messageListType === 'scheduled') }),
...(typeof uploadProgress === 'number' && { uploadProgress }),
...(isFocused && { focusDirection, noFocusHighlight }),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [

View File

@ -459,15 +459,15 @@ export default memo(withGlobal<OwnProps>(
areMembersHidden,
canAddMembers,
canDeleteMembers,
...(hasMembersTab && members && {
members,
usersById,
}),
currentUserId: global.currentUserId,
isRightColumnShown: selectIsRightColumnShown(global),
isRestricted: chat && chat.isRestricted,
lastSyncTime: global.lastSyncTime,
serverTimeOffset: global.serverTimeOffset,
...(hasMembersTab && members && {
members,
usersById,
}),
};
},
(setGlobal, actions): DispatchProps => pick(actions, [