Skip to content

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

DEV: Fix a chat upload spec flake (#40666)

Jarek Radosz400e914c0c53
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
index 823961ce932..e79af40f18e 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
@@ -244,18 +244,18 @@ export default class ChatComposer extends Component {
this.inProgressUploadsCount = inProgressUploadsCount || 0;
+ this.composer.textarea?.focus();
+ this.reportReplyingPresence();
+
+ // Only persist once uploads settle.
if (
typeof uploads !== "undefined" &&
- inProgressUploadsCount !== "undefined" &&
inProgressUploadsCount === 0 &&
this.draft
) {
this.draft.uploads = cloneJSON(uploads);
+ this.persistDraft();
}
-
- this.composer.textarea?.focus();
- this.reportReplyingPresence();
- this.persistDraft();
}
@action