Skip to content

fix: close thread when its parent message is deleted - #1458

Open
Kulraj69 wants to merge 2 commits into
RocketChat:developfrom
Kulraj69:fix/close-thread-on-parent-delete
Open

Kulraj69 wants to merge 2 commits into
RocketChat:developfrom
Kulraj69:fix/close-thread-on-parent-delete

Conversation

@Kulraj69

@Kulraj69 Kulraj69 commented Nov 22, 2026 •

Copy link
Copy Markdown

Close the thread view when its parent message is deleted

Acceptance Criteria fulfillment

  • Deleting the parent of the open thread (locally or from another client, via the room's message-deleted listener) closes the thread view
  • Thread state is cleared: isThreadOpen, threadMainMessage and threadMessages are reset, and the parent is removed from the main list
  • Deleting a thread reply or an unrelated message keeps the current behaviour

Fixes #1080

Changes

  • packages/react/src/store/messageStore.js: removeMessage checks whether the deleted id is the active thread's parent and, in one set, closes the thread and clears its state. This also works when the parent isn't in the loaded main list.
  • packages/react/src/store/messageStore.test.js: 7 regression tests (parent deleted, parent absent from the list, reply deleted, unrelated/unknown id, empty state, repeated events).
  • Made the React package's Jest runnable: a test-only CommonJS override in babel.config.js (the Rollup build config is unchanged), jest.config.js with jsdom, and a fix for the stale RCComponent import in src/index.test.js, which couldn't run before.
  • Changeset: @embeddedchat/react patch.

Video/Screenshots

N/A: this is a store-level fix covered by unit tests.

PR Test Details

cd packages/react && npx jest
PASS src/store/messageStore.test.js
PASS src/index.test.js
Tests: 9 passed, 9 total

yarn build for packages/react, ESLint and Prettier pass.

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-1458 after approval.

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.

Bug: Thread UI remains open after parent message is deleted (State Leak)

1 participant