Skip to content

fix: drop onMessage/onTyping frames that lack fields.args - #436

Open
arbazkhan971 wants to merge 1 commit into
RocketChat:mobilefrom
arbazkhan971:fix-onmessage-ontyping-malformed-frames
Open

arbazkhan971 wants to merge 1 commit into
RocketChat:mobilefrom
arbazkhan971:fix-onmessage-ontyping-malformed-frames

Conversation

@arbazkhan971

Copy link
Copy Markdown

Summary

onMessage and onTyping destructured fields.args with no guard. A changed frame without fields, or with fields but no args, threw a TypeError on the emit path.

Both handlers now drop that frame and log it at error instead of throwing. Existing well-formed frames still call back as before.

Test plan

  • Existing well-formed onMessage / onTyping tests still pass
  • New tests assert a missing fields.args does not throw and does not call the callback
  • npx tsc --noEmit
  • npm run lint

Fixes #378

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

fix: onMessage and onTyping throw on a stream frame without fields.args

2 participants