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

This commit is contained in:
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

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[] = [];