Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d850c95

Browse files
authored
Respect user cancelling upload flow by dismissing spinner (#10373)
1 parent 1c9ea42 commit d850c95

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/ContentMessages.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,13 @@ export default class ContentMessages {
378378
if (!this.mediaConfig) {
379379
// hot-path optimization to not flash a spinner if we don't need to
380380
const modal = Modal.createDialog(Spinner, undefined, "mx_Dialog_spinner");
381-
await this.ensureMediaConfigFetched(matrixClient);
382-
modal.close();
381+
await Promise.race([this.ensureMediaConfigFetched(matrixClient), modal.finished]);
382+
if (!this.mediaConfig) {
383+
// User cancelled by clicking away on the spinner
384+
return;
385+
} else {
386+
modal.close();
387+
}
383388
}
384389

385390
const tooBigFiles: File[] = [];

0 commit comments

Comments
 (0)