diff --git a/app/containers/message/Blocks.ts b/app/containers/message/Blocks.ts index 253af3ccc..278e0a205 100644 --- a/app/containers/message/Blocks.ts +++ b/app/containers/message/Blocks.ts @@ -3,45 +3,31 @@ import React from 'react'; import { messageBlockWithContext } from '../UIKit/MessageBlock'; import { IMessageBlocks } from './interfaces'; -const Blocks = React.memo( - ({ blocks, id: mid, rid, blockAction }: IMessageBlocks) => { - if (blocks && blocks.length > 0) { - const appId = blocks[0]?.appId || ''; - return React.createElement( - messageBlockWithContext({ - action: async ({ actionId, value, blockId }: { actionId: string; value: string; blockId: string }) => { - if (blockAction) { - await blockAction({ - actionId, - appId, - value, - blockId, - rid, - mid - }); - } - }, - appId, - rid - }), - { blocks } - ); - } - return null; - }, - (prevProps, nextProps) => { - if ( - // @ts-ignore - ('type' in prevProps.blocks[0] && prevProps.blocks[0].type === 'video_conf') || - // @ts-ignore - ('type' in nextProps.blocks[0] && nextProps.blocks[0].type === 'video_conf') - ) { - // Avoid multiple request on the VideoConferenceBlock - return true; - } - return false; +const Blocks = ({ blocks, id: mid, rid, blockAction }: IMessageBlocks) => { + if (blocks && blocks.length > 0) { + const appId = blocks[0]?.appId || ''; + return React.createElement( + messageBlockWithContext({ + action: async ({ actionId, value, blockId }: { actionId: string; value: string; blockId: string }) => { + if (blockAction) { + await blockAction({ + actionId, + appId, + value, + blockId, + rid, + mid + }); + } + }, + appId, + rid + }), + { blocks } + ); } -); + return null; +}; Blocks.displayName = 'MessageBlocks'; diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx index ff309cfd8..e899b5662 100644 --- a/app/containers/message/index.tsx +++ b/app/containers/message/index.tsx @@ -76,20 +76,29 @@ class MessageContainer extends React.Component { - this.forceUpdate(); + if (this.mounted) { + this.forceUpdate(); + } }); } } + componentDidMount() { + this.mounted = true; + } + shouldComponentUpdate(nextProps: IMessageContainerProps, nextState: IMessageContainerState) { const { isManualUnignored } = this.state; const { threadBadgeColor, isIgnored, highlighted, previousItem } = this.props;