diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js --- a/lib/selectors/chat-selectors.js +++ b/lib/selectors/chat-selectors.js @@ -594,7 +594,7 @@ return state.messageStore.threads[threadInfo.containingThreadID]; }); - const editedText = React.useMemo(() => { + const pendingSidebarEditMessageInfo = React.useMemo(() => { const sourceMessageID = threadInfo?.sourceMessageID; const threadMessageInfos = (containingThread?.messageIDs ?? []) .map((messageID: string) => messageInfos[messageID]) @@ -607,8 +607,8 @@ if (threadMessageInfos.length === 0) { return null; } - return threadMessageInfos[0].text; - }, [containingThread?.messageIDs, messageInfos, threadInfo?.sourceMessageID]); + return threadMessageInfos[0]; + }, [threadInfo, containingThread, messageInfos]); const pendingSidebarSourceMessageInfo = useSelector(state => { const sourceMessageID = threadInfo?.sourceMessageID; @@ -630,14 +630,7 @@ if (!shouldSourceBeAdded) { return null; } - let result = messageInfos[sourceMessageID]; - if (result && result.type === messageTypes.TEXT && editedText) { - result = { - ...result, - text: editedText, - }; - } - return result; + return messageInfos[sourceMessageID]; }); invariant( @@ -646,11 +639,16 @@ 'sidebars can not be created from sidebar_source message', ); - const additionalMessages = React.useMemo( - () => - pendingSidebarSourceMessageInfo ? [pendingSidebarSourceMessageInfo] : [], - [pendingSidebarSourceMessageInfo], - ); + const additionalMessages = React.useMemo(() => { + if (!pendingSidebarSourceMessageInfo) { + return []; + } + const result = [pendingSidebarSourceMessageInfo]; + if (pendingSidebarEditMessageInfo) { + result.push(pendingSidebarEditMessageInfo); + } + return result; + }, [pendingSidebarSourceMessageInfo, pendingSidebarEditMessageInfo]); const boundMessageListData = useSelector( messageListData(threadInfo?.id, additionalMessages), ); diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js --- a/native/chat/composed-message.react.js +++ b/native/chat/composed-message.react.js @@ -7,6 +7,7 @@ import Animated from 'react-native-reanimated'; import { createMessageReply } from 'lib/shared/message-utils.js'; +import { threadIsPending } from 'lib/shared/thread-utils.js'; import { assertComposableMessageType } from 'lib/types/message-types.js'; import { @@ -162,14 +163,19 @@ ); + const isPending = threadIsPending(item.threadInfo.id); + let label; + if (hasBeenEdited && !isPending) { + label = 'Edited'; + } + let inlineEngagement = null; if ( item.threadCreatedFromMessage || Object.keys(item.reactions).length > 0 || - hasBeenEdited + label ) { const positioning = isViewer ? 'right' : 'left'; - const label = hasBeenEdited ? 'Edited' : null; inlineEngagement = ( 0) { height += inlineEngagementStyle.height + inlineEngagementStyle.marginTop + inlineEngagementStyle.marginBottom; - } else if (item.hasBeenEdited) { + } else if (item.hasBeenEdited && !isPending) { height += editedLabelHeight; } return height; diff --git a/web/chat/composed-message.react.js b/web/chat/composed-message.react.js --- a/web/chat/composed-message.react.js +++ b/web/chat/composed-message.react.js @@ -10,6 +10,7 @@ import { useStringForUser } from 'lib/hooks/ens-cache.js'; import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; +import { threadIsPending } from 'lib/shared/thread-utils.js'; import { assertComposableMessageType } from 'lib/types/message-types.js'; import { type ThreadInfo } from 'lib/types/thread-types.js'; @@ -121,14 +122,19 @@ ); } + const isPending = threadIsPending(threadInfo.id); + let label; + if (hasBeenEdited && !isPending) { + label = 'Edited'; + } + let inlineEngagement = null; if ( (this.props.containsInlineEngagement && item.threadCreatedFromMessage) || Object.keys(item.reactions).length > 0 || - hasBeenEdited + label ) { const positioning = isViewer ? 'right' : 'left'; - const label = hasBeenEdited ? 'Edited' : null; inlineEngagement = (