Skip to content

Conversation

@sushmi21
Copy link
Contributor

@sushmi21 sushmi21 commented Nov 28, 2025

This PR fixes the rendering of empty message bubbles

Success Criteria:

  • If the streaming collation is turned off, a message containing only an escape sequence should not be rendered irrespective of the render markdown setting. (There should not be empty message bubble)

Te test:

  • Check the example added for escape sequence check in the demo page > Text Messages tab.
  • Please note that there is a regression in rendering number 0 message, so you will see one empty bubble.

@sushmi21 sushmi21 marked this pull request as ready for review December 3, 2025 10:11
Copilot AI review requested due to automatic review settings December 3, 2025 10:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where message bubbles containing only whitespace or escape sequences were being rendered as empty bubbles. The fix extracts the escape sequence detection logic into a reusable utility function and updates the message matching logic to properly handle these cases.

Key Changes:

  • Introduced a utility function to detect strings containing only escape sequences/whitespace
  • Updated message matching logic to filter out escape-sequence-only messages when streaming collation is disabled
  • Added a test case demonstrating the fix for messages with only newlines and spaces

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/utils.ts Added isOnlyEscapeSequence utility function to detect whitespace-only strings
src/matcher.ts Updated message validation to use the new utility and removed redundant markdown check
test/demo.tsx Added test case for whitespace-only message bubble scenario

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@vj-venkatesan vj-venkatesan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex looks good. Although I don't understand why the empty bubble shows up when your text is " \n\n"

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.

3 participants