Skip to content

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

FIX: deactivate is not called in every cases (#19301)

Joffrey JAFFEUX801b3f087fc4
diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat.js b/plugins/chat/assets/javascripts/discourse/routes/chat.js
index 91668c537c4..9a2b222f21f 100644
--- a/plugins/chat/assets/javascripts/discourse/routes/chat.js
+++ b/plugins/chat/assets/javascripts/discourse/routes/chat.js
@@ -66,8 +66,6 @@ export default class ChatRoute extends DiscourseRoute {
}
deactivate() {
- this.chat.setActiveChannel(null);
-
schedule("afterRender", () => {
document.body.classList.remove("has-full-page-chat");
document.documentElement.classList.remove("has-full-page-chat");
@@ -77,6 +75,8 @@ export default class ChatRoute extends DiscourseRoute {
@action
willTransition(transition) {
+ this.chat.setActiveChannel(null);
+
if (!transition?.to?.name?.startsWith("chat.")) {
this.chatStateManager.storeChatURL();
this.chat.updatePresence();