Skip to content

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

FIX: at this point in time component can be destroyed (#19677)

Joffrey JAFFEUX96e2d9212911
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);