Skip to content

A platform for community discussion. Free, open, simple.

FIX: Avoid transitioning when a chat thread component is destroyed (#22457)

Alan Guo Xiang Tan4c810703c15c
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js b/plugins/chat/assets/javascripts/discourse/components/chat-thread.js
index 7184f3664ba..bec16e7b756 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.js
@@ -166,10 +166,11 @@ export default class ChatThreadPanel extends Component {
return this.chatApi
.channel(this.args.thread.channel.id, findArgs)
.then((result) => {
- if (
- this._selfDeleted ||
- this.args.thread.channel.id !== result.meta.channel_id
- ) {
+ if (this._selfDeleted) {
+ return;
+ }
+
+ if (this.args.thread.channel.id !== result.meta.channel_id) {
if (this.chatHistory.previousRoute?.name === "chat.channel.index") {
this.router.transitionTo(
"chat.channel",