Respect user cancelling upload flow by dismissing spinner (#10373)

t3chguy/dedup-icons-17oct
Michael Telatynski 2023-03-16 12:24:22 +00:00 committed by GitHub
parent 1c9ea423c9
commit d850c95099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -378,8 +378,13 @@ export default class ContentMessages {
if (!this.mediaConfig) {
// hot-path optimization to not flash a spinner if we don't need to
const modal = Modal.createDialog(Spinner, undefined, "mx_Dialog_spinner");
await this.ensureMediaConfigFetched(matrixClient);
modal.close();
await Promise.race([this.ensureMediaConfigFetched(matrixClient), modal.finished]);
if (!this.mediaConfig) {
// User cancelled by clicking away on the spinner
return;
} else {
modal.close();
}
}
const tooBigFiles: File[] = [];