Skip to content

fix(react): eliminate quadratic quote duplication and async race condition in ChatInput - #1469

Open
swarnendusahu10-dotcom wants to merge 2 commits into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/chatinput-quote-duplication-race-condition
Open

swarnendusahu10-dotcom wants to merge 2 commits into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/chatinput-quote-duplication-race-condition

Conversation

@swarnendusahu10-dotcom

Copy link
Copy Markdown
Contributor

Proposed changes

Fixes a state mutation and logic bug in ChatInput where quoting multiple messages caused quadratic message duplication and async race conditions.

Key Highlights

  • Prevents Quote Duplication: Replaces the nested quotedMessages += ... mutation inside quoteArray.join('') with pure map resolution, preventing duplicate quote links when quoting two or more messages.
  • Race Condition Elimination: Eliminates asynchronous closure variable mutations inside Promise.all concurrent callbacks.
  • Resilient Error Handling: Adds safe try...catch handling to ensure permalink generation errors do not block outgoing message dispatch.
  • Changeset: Added .changeset/fix-quote-duplication-race-condition.md.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • Refactor (non-breaking change which improves code quality)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

Checklist

  • I have read the Contributing Guidelines.
  • Lint passes locally with my changes.
  • I have added a changeset file for @embeddedchat/react.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant