Skip to content

fix(rtc): leave ChatMessage editTimestamp undefined when unset - #738

Closed
RaphaelFakhri wants to merge 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/chat-message-edit-timestamp
Closed

RaphaelFakhri wants to merge 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/chat-message-edit-timestamp

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Description

ChatMessage.editTimestamp is optional, but Room chat events and the results of sendChatMessage and editChatMessage build it with Number(editTimestamp). For a message that was never edited the protobuf value is undefined, so the result is NaN.

This change adds chatMessageFromProto in utils.ts. It converts the fields with bigIntToNumber, which keeps undefined, and the three call sites use it. generated is now also present on the results of sendChatMessage and editChatMessage, matching the chat event.

Testing

Added two tests for chatMessageFromProto in utils.test.ts: one for an unedited message and one for an edited message.

  • With the previous Number(...) conversion: 7 passed, 1 failed (editTimestamp is NaN).
  • With the change: 8 passed.

Command: pnpm prebuild && npx vitest run src/utils.test.ts in packages/livekit-rtc.

A patch changeset for @livekit/rtc-node is included.

@changeset-bot

changeset-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 74e4c60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/rtc-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant

CLAassistant commented Sep 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

2 participants