From 96e2d9212911faf62ccc6ddd74e728ddfdde79be Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 2 Jan 2023 19:17:10 +0100 Subject: [PATCH] FIX: at this point in time component can be destroyed (#19677) Especially possible in tests --- .../components/chat-channel-selector-modal-inner.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-selector-modal-inner.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel-selector-modal-inner.js index 86ac4fe5615..81ff741afe5 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-selector-modal-inner.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-selector-modal-inner.js @@ -131,6 +131,10 @@ export default Component.extend({ @action fetchChannelsFromServer(filter) { + if (this.isDestroyed || this.isDestroying) { + return; + } + this.setProperties({ loading: true, searchIndex: this.searchIndex + 1, @@ -165,6 +169,10 @@ export default Component.extend({ @action getInitialChannels() { + if (this.isDestroyed || this.isDestroying) { + return; + } + const channels = this.getChannelsWithFilter(this.filter); this.set("channels", channels); this.focusFirstChannel(channels);