Repository navigation
Editing Messages 409 Conflict #414
Description
Activity
@tance77 thank you for reaching out.
I tried to reproduce the
A→B→C→Aflow and the last step gave me a conflict error (tried with regular REST API).As for a potential workaround (will suggest it to the Chat team because the Core SDK developed by another team) could be:
- edit text
- do nothing on success
- on error:
- fetch reactions for message
- find edit action with value which has been used with failed edit
- delete reaction with previous edit
- re-send edit, which should be successful this time.
Because of complexity and potential errors (if any, structure will change in published reactions) it probably would be better to do as part of
editTextfunction call inside of Chat JS SDK.Reacted by Lance and Stephen Blum@parfeon Thanks for the solution—it works!
I'm still a bit confused, though, about why a conflict occurs when the time tokens differ, but the content is the same. Shouldn't that be valid? Or, better yet, what's the reasoning behind it being considered a conflict?
@tance77 the Chat SDK team is going to try to assess this improvement suggestion and add it to their backlog (maybe they will implement it differently or our endpoints will evolve to that time).
- addedstatus: waitingThis issue waits for feedback from author.This issue waits for feedback from author.type: questionThis issue is a question.This issue is a question.priority: mediumThis PR should be reviewed after all high priority PRs.This PR should be reviewed after all high priority PRs.
on Oct 29, 2024
When editing a message I’ve noticed an issue: going from the message text
AtoBand then back toAcauses a 409 conflict error. However, if I edit fromAtoB, then toC, and finally back to A, there’s no conflict. This behavior is confusing—why does the system only check the previous action?Function that we're having issues with:
https://github.com/pubnub/js-chat/blob/master/lib/src/entities/message.ts#L202
What would be the best way to work around this behavior when editing a message?
Idea 1:
We could delete all actions following the conflict, but the time token would not update.
Idea 2:
Delete all the edit actions, but then changes in the UI flash from
AtoEMPTYtoBtoEMPTYtoA