diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -367,8 +367,7 @@ ); const orderedNewMessageInfos = _flow( _map((messageInfo: RawMessageInfo) => { - const { id: inputID } = messageInfo; - invariant(inputID, 'new messageInfos should have serverID'); + const inputID = messageID(messageInfo); invariant( !threadIsPending(messageInfo.threadID), 'new messageInfos should have realized thread id', @@ -383,6 +382,9 @@ const currentLocalMessageInfo = inputLocalID ? updatedMessageStore.messages[inputLocalID] : null; + const isThick = threadTypeIsThick( + threadInfos[messageInfo.threadID].type, + ); if (currentMessageInfo && currentMessageInfo.localID) { // If the client already has a RawMessageInfo with this serverID, keep // any localID associated with the existing one. This is because we @@ -428,10 +430,13 @@ localID: currentLocalMessageInfo.localID, }: RawImagesMessageInfo); } - } else { + } else if (!isThick) { // If neither the serverID nor the localID from the delivered // RawMessageInfo exists in the client store, then this message is // brand new to us. Ignore any localID provided by the server. + // It is also possible that this is a failed thick thread message, + // in which case we shouldn't remove the localID, because this + // message doesn't have an ID yet. // (The conditional below is for Flow) const { localID, ...rest } = messageInfo; if (rest.type === messageTypes.TEXT) {