[Problem/Question]
My message ID is wrong when adding a message. LID on creation is not the same as on update.
// If problem, please fill out the below. If question, please delete.
[SDK Version]
sendbird_chat_sdk: 4.2.10
[Reproduction Steps]
1/ Add MessageCollectionHandler
2/ Check message ID in onMessagesAdded
3/ Check message ID in onMessagesUpdated
4/ IDs are not the same for the same message
[Frequency]
Always
[Current impact]
Very strong
The MessageCollection
would give a pending message to onMessagesAdded
where every pending message has a message ID of zero. Then when the message is sent successfully or failed sending, it gives an event onMessagesUpdated
to update the message. In that case the message ID is set to the actual ID if succeeded. (And stays zero if it fails)
It’s designed by nature that a pending message is to preview the message before being sent, then updated to a succeeded message. If you’re rendering messages with a unique key, you can refer to requestId
instead (succeeded messages also have it). You can check the message status with sendingStatus
property in a message.
Hello Chris,
Thank you, this is exactly what I was looking for
Have a nice day,