ug(react): guard against null childElement in MessageAggregator setJumpToMessage

Open Beginner friendly
#1,478 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Suraj704-glitch is already working on this.

Since Nov 30, 2026.

  • #1479 by @Suraj704-glitch — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, react
Domain
frontend

Research direction

Read packages/react/src/views/MessageAggregators/common/MessageAggregator.js, especially the two setJumpToMessage locations cited in the issue. Check how the jump behaves when document.getElementById finds no message element, then run the relevant tests or reproduce from a MessageAggregator sidebar or popup. Done means clicking the arrow when the target is absent no longer throws, while normal jumps still work.

Written by the indexing model from the issue text.

Description

Description

Clicking the jump-to-message (arrow-back) button in MessageAggregator (Pinned, Starred, Mentions, Search, or Threads sidebar/popup) throws an uncaught TypeError when the target message element is not present in the DOM.

Root Cause

In packages/react/src/views/MessageAggregators/common/MessageAggregator.js (lines 81–84 and 108–111), setJumpToMessage runs:

const childElement = document.getElementById(`ec-message-body-${msgId}`);
element = childElement.closest('.ec-message');
Dominant language
JavaScript
Stars
171
Forks
421
Avg merge
3d 6h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/EmbeddedChat

All issues in RocketChat/EmbeddedChat

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.