Open tance77 opened 1 month ago
@tance77 thank you for reaching out.
I tried to reproduce the A
→B
→C
→A
flow 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:
Because of complexity and potential errors (if any, structure will change in published reactions) it probably would be better to do as part of editText
function call inside of Chat JS SDK.
@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).
When editing a message I’ve noticed an issue: going from the message text
A
toB
and then back toA
causes a 409 conflict error. However, if I edit fromA
toB
, 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
A
toEMPTY
toB
toEMPTY
toA