FIX: Composer doesn't show an error message in case of a network issue and stops updating draft after (#13268)

This commit is contained in:
Andrei Prigorshnev 2021-06-04 16:15:47 +04:00 committed by GitHub
parent da2889a7a8
commit 476dfaed2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -70,6 +70,12 @@ export function ajax() {
args = arguments[1];
}
let ignoreUnsent = true;
if (args.ignoreUnsent !== undefined) {
ignoreUnsent = args.ignoreUnsent;
delete args.ignoreUnsent;
}
function performAjax(resolve, reject) {
args.headers = args.headers || {};
@ -112,7 +118,7 @@ export function ajax() {
args.error = (xhr, textStatus, errorThrown) => {
// 0 represents the `UNSENT` state
if (xhr.readyState === 0) {
if (ignoreUnsent && xhr.readyState === 0) {
// Make sure we log pretender errors in test mode
if (textStatus === "error" && isTesting()) {
throw errorThrown;

View File

@ -34,6 +34,7 @@ Draft.reopenClass({
owner: clientId,
force_save: forceSave,
},
ignoreUnsent: false,
});
},
});