Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ChatListItem = React.memo(props => {
const { chatListItem, onClick } = props
if (chatListItem === null) return null
if (typeof chatListItem === 'undefined') return
if (chatListItem.id === C.DC_CHAT_ID_DEADDROP) return
if (chatListItem.id === C.DC_CHAT_ID_ARCHIVED_LINK) return
return
}, (prevProps, nextProps) => {
const shouldRerender = prevProps.chatListItem !== nextProps.chatListItem || prevProps.isSelected !== nextProps.isSelected
return {
id: chat.id,
name: chat.name || summary.text1,
avatarPath: chat.profileImage,
color: integerToHexColor(chat.color),
lastUpdated: lastUpdated,
summary: {
text1: summary.text1,
text2: summary.text2,
status: mapCoreMsgStatus2String(summary.state)
},
deaddrop: chat.deaddrop,
isVerified: chat.isVerified,
isGroup: isGroup,
freshMessageCounter: this._dc.getFreshMessageCount(chatId),
isArchiveLink: chat.id === C.DC_CHAT_ID_ARCHIVED_LINK,
contactIds,
isSelfTalk: chat.isSelfTalk,
isDeviceTalk: chat.isDeviceTalk,
selfInGroup: isGroup && contactIds.indexOf(C.DC_CONTACT_ID_SELF) !== -1
}
}
const onChatClick = chatId => {
if (chatId === C.DC_CHAT_ID_ARCHIVED_LINK) return onShowArchivedChats()
props.onChatClick(chatId)
}