Don't mutate state in TimelineItem

This commit is contained in:
Fedor Indutny 2021-08-19 13:14:41 -07:00 committed by GitHub
parent 1cc7c5dc2d
commit 80c1ad6ee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 127 additions and 61 deletions

View file

@ -10,7 +10,6 @@ import { StateType } from '../reducer';
import { TimelineItem } from '../../components/conversation/TimelineItem';
import { getIntl, getInteractionMode, getTheme } from '../selectors/user';
import {
getContactNameColorSelector,
getConversationSelector,
getMessageSelector,
getSelectedMessage,
@ -44,14 +43,6 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
const messageSelector = getMessageSelector(state);
const item = messageSelector(id);
if (item?.type === 'message' && item.data.conversationType === 'group') {
const { author } = item.data;
item.data.contactNameColor = getContactNameColorSelector(state)(
conversationId,
author.id
);
}
const selectedMessage = getSelectedMessage(state);
const isSelected = Boolean(selectedMessage && id === selectedMessage.id);