Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateMessage doesn't stay updated #830

Closed
Motoxpro opened this issue Dec 2, 2021 · 2 comments
Closed

updateMessage doesn't stay updated #830

Motoxpro opened this issue Dec 2, 2021 · 2 comments

Comments

@Motoxpro
Copy link

Motoxpro commented Dec 2, 2021

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
Copy link
Author

Motoxpro commented Dec 2, 2021

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,
);

@vanGalilea
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants