diff --git a/src/components/Channel/Channel.tsx b/src/components/Channel/Channel.tsx index 2f6a3c007..8553bf432 100644 --- a/src/components/Channel/Channel.tsx +++ b/src/components/Channel/Channel.tsx @@ -885,9 +885,13 @@ const ChannelInner = < const updateMessage = ( updatedMessage: MessageToSend | StreamMessage, + timestampChanged = true, ) => { // add the message to the local channel state - channel.state.addMessageSorted(updatedMessage as MessageResponse, true); + channel.state.addMessageSorted( + updatedMessage as MessageResponse, + timestampChanged, + ); dispatch({ channel, diff --git a/src/components/Message/hooks/useReactionHandler.ts b/src/components/Message/hooks/useReactionHandler.ts index 271421342..3c9281de6 100644 --- a/src/components/Message/hooks/useReactionHandler.ts +++ b/src/components/Message/hooks/useReactionHandler.ts @@ -93,7 +93,7 @@ export const useReactionHandler = < const tempMessage = createMessagePreview(add, newReaction, message); try { - updateMessage(tempMessage); + updateMessage(tempMessage, false); // @ts-expect-error thread?.upsertReplyLocally({ message: tempMessage }); @@ -102,10 +102,10 @@ export const useReactionHandler = < : await channel.deleteReaction(id, type); // seems useless as we're expecting WS event to come in and replace this anyway - updateMessage(messageResponse.message); + updateMessage(messageResponse.message, false); } catch (error) { // revert to the original message if the API call fails - updateMessage(message); + updateMessage(message, false); // @ts-expect-error thread?.upsertReplyLocally({ message }); } diff --git a/src/context/ChannelActionContext.tsx b/src/context/ChannelActionContext.tsx index 36acea39f..fa4ace23c 100644 --- a/src/context/ChannelActionContext.tsx +++ b/src/context/ChannelActionContext.tsx @@ -95,7 +95,7 @@ export type ChannelActionContextValue< setQuotedMessage: React.Dispatch< React.SetStateAction | undefined> >; - updateMessage: (message: StreamMessage) => void; + updateMessage: (message: StreamMessage, timestampChanged?: boolean) => void; }; export const ChannelActionContext = React.createContext(