Skip to content

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

DEV: potential flakey specs fixes (#21307)

Joffrey JAFFEUXcd2465657001
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
index 3e081287531..dac1c885356 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
@@ -452,7 +452,10 @@ export default class ChatLivePane extends Component {
// if the last visible message is not fully visible, we don't want to mark it as read
// attempt to mark previous one as read
- if (!this.#isBottomOfMessageVisible(element, this.scrollable)) {
+ if (
+ element &&
+ !this.#isBottomOfMessageVisible(element, this.scrollable)
+ ) {
lastUnreadVisibleMessage = lastUnreadVisibleMessage.previousMessage;
if (
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
index 192f0b8490e..b6916fa2336 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
@@ -33,6 +33,10 @@ export default class ChatSidePanel extends Component {
@action
didResize(element, size) {
+ if (this.isDestroying || this.isDestroyed) {
+ return;
+ }
+
const parentWidth = element.parentElement.getBoundingClientRect().width;
const mainPanelWidth = parentWidth - size.width;