From 8a792bdf0b7961f4f735a3129ebf3a2240cab71c Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 28 Dec 2022 16:01:41 +0100 Subject: [PATCH] FIX: cancels fetching messages when pane is destroyed (#19642) Ultimately we would want a cleaner solution here where we correctly cancel in `willDestroy` hook but this is the safest move for now. --- .../assets/javascripts/discourse/components/chat-live-pane.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js index 8b01739743..ef2ab7639c 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js @@ -229,6 +229,10 @@ export default Component.extend({ @debounce(100) fetchMessages(channel, options = {}) { + if (this._selfDeleted) { + return; + } + this.set("loading", true); return this.chat.loadCookFunction(this.site.categories).then((cook) => {