stream-chat-js icon indicating copy to clipboard operation
stream-chat-js copied to clipboard

updateMessage doesn't stay updated

Open Motoxpro opened this issue 4 years ago • 1 comments

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?

Motoxpro avatar Dec 02 '21 11:12 Motoxpro

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 avatar Dec 02 '21 12:12 Motoxpro

@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.

vanGalilea avatar Oct 14 '22 07:10 vanGalilea