stream-chat-js
stream-chat-js copied to clipboard
updateMessage doesn't stay updated
Thanks for a great product!
I am using "stream-chat": "4.4.3", on the server-side
I am using the following code to create a message:
const offerMessage = await channel.sendMessage({
user_id: streamSystemUser.id,
mml: offerMML,
});
This works great, I then use:
await serverClient.updateMessage({
id: coachCustomerLesson.offerMessageId,
mml: newOfferMML,
user_id: streamSystemUser.id,
});
To update the message. It updates in the channel immediately, but when I refresh the page, the mml is back to the original offerMML.
Am I doing something wrong here?
This seems to work. Using a partialUpdate here which is unrelated.
Just have to "delete" the mml and then re-update it.
await serverClient.partialUpdateMessage(
coachCustomerLesson.offerMessageId,
{
set: {
mml: '',
text: 'Updating...',
},
},
streamSystemUser.id,
);
await serverClient.partialUpdateMessage(
coachCustomerLesson.offerMessageId,
{
set: {
mml: newOfferMML,
text: '',
},
},
streamSystemUser.id,
);
@Motoxpro thanks for reaching out. I'll be closing this issue since you found a solution. Please don't hesitate to contact us in the future if this issue or any questions arise.