Skip to content

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

DEV: Add a lifetime check to an async chat-pane-state operation (#36740)

Jarek Radosz8b0a7af586d3
diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js b/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
index 3e57a77dca0..acdea9dd50a 100644
--- a/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
@@ -271,6 +271,10 @@ export default class ChatPaneState {
this.addPendingMessages(messageCount);
schedule("afterRender", () => {
+ if (this.isDestroying || this.isDestroyed) {
+ return;
+ }
+
this.hasPendingContentBelow = this.#computeHasPendingContentBelow(
scroller,
false