Skip to content

fix(room-kit): keep links in message order when splitting chat text - #1712

Open
RaphaelFakhri wants to merge 1 commit into
100mslive:mainfrom
RaphaelFakhri:fix/chat-link-order
Open

RaphaelFakhri wants to merge 1 commit into
100mslive:mainfrom
RaphaelFakhri:fix/chat-link-order

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Description

splitLinksAndContent replaces each link in a message with a <link> marker and then fills the markers from the list of matched links with links.pop(). pop() takes links from the end of the list, so a message with two or more links renders them in reverse order: the first marker shows the last link, and pressing it opens the wrong URL. The function is used for chat messages, HLS messages, overlay messages and the HLS description.

This change takes links from the front of the list with shift(). It also configures the package's Jest transform to use @react-native/babel-preset, because metro-react-native-babel-preset from babel.config.js is not installed in this package, so yarn test cannot run any test today.

Test command: cd packages/react-native-room-kit && npx jest src/utils/functions.links.test.tsx

Fixes #1710


Additional context

Without the source change, the new order test fails (1 failed, 1 passed). With the change, both tests pass.

Pre-launch Checklist

  • The Documentation is updated accordingly, or this PR doesn't require it.
  • I have updated the ExampleAppChangelog.txt file with relevant changes.
  • I updated/added relevant documentation (doc comments with ///).
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@RaphaelFakhri
RaphaelFakhri requested a review from ygit as a code owner September 29, 2026 14:36
@trunk-io

trunk-io Bot commented Sep 29, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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.

Links in a chat message are rendered in reverse order

1 participant