Bug: Thread UI remains open after parent message is deleted (State Leak)
A frontend state management bug exists where the Thread View remains open and displays stale data even after its parent message has been deleted from the chat.
While the messageStore correctly removes the deleted message from the main message list, it fails to synchronize thread-specific state. As a result, thread-related state continues to reference a message that no longer exists.
Observed Behavior
- The parent message is removed from the main chat message list.
- The Thread Pane remains open.
- The Thread View continues to display a stale copy of the deleted parent message.
- The application enters an inconsistent UI state where a thread is shown for a non-existent message.
Screenshots
Rocket chat web
Embedded chat
Expected Behavior
When a parent message is deleted:
- Any active thread associated with that message should automatically close.
- Thread-related state should be cleared from the store.
- The UI should return to the normal chat view without an open thread.
Steps to Reproduce
- Open the EmbeddedChat application.
- Send a new message or select an existing message.
- Open the Thread View for that message.
- Delete the parent message (from EmbeddedChat or another client).
- Observe the UI state.
Result:
- The message disappears from the main chat list.
- The Thread Pane remains open with stale data.
@Spiral-Memory pls let me know about this
Hi @Spiral-Memory — is this one free to pick up (not earmarked for GSoC)? Looks like the thread view holds its own copy of the parent message, so when messageStore removes it the ThreadView never resets. I'd fix it by deriving the open thread from the store (and closing the view when the parent id disappears) rather than patching the symptom. Happy to open a PR if that direction works.