Skip to content

Editing Messages 409 Conflict #414

Description

@tance77

When editing a message I’ve noticed an issue: going from the message text A to B and then back to A causes a 409 conflict error. However, if I edit from A to B, then to C, 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 to EMPTY to B to EMPTY to A

Activity

  1. parfeon commented on Oct 15, 2024

    @parfeon
    Contributor

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

    1. edit text
    2. do nothing on success
    3. on error:
      1. fetch reactions for message
      2. find edit action with value which has been used with failed edit
      3. delete reaction with previous edit
      4. 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 editText function call inside of Chat JS SDK.

  2. tance77 commented on Oct 15, 2024

    @tance77
    Author

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

  3. parfeon commented on Oct 17, 2024

    @parfeon
    Contributor

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

  4. self-assigned this
    on Oct 29, 2024
  5. added
    status: waitingThis issue waits for feedback from author.
    priority: mediumThis PR should be reviewed after all high priority PRs.
    on Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: mediumThis PR should be reviewed after all high priority PRs.status: waitingThis issue waits for feedback from author.type: questionThis issue is a question.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions