diff --git a/app/assets/javascripts/discourse/app/lib/ajax.js b/app/assets/javascripts/discourse/app/lib/ajax.js index a47ed559de..48b690c845 100644 --- a/app/assets/javascripts/discourse/app/lib/ajax.js +++ b/app/assets/javascripts/discourse/app/lib/ajax.js @@ -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; diff --git a/app/assets/javascripts/discourse/app/models/draft.js b/app/assets/javascripts/discourse/app/models/draft.js index 5406c7f9b8..37dda0ba76 100644 --- a/app/assets/javascripts/discourse/app/models/draft.js +++ b/app/assets/javascripts/discourse/app/models/draft.js @@ -34,6 +34,7 @@ Draft.reopenClass({ owner: clientId, force_save: forceSave, }, + ignoreUnsent: false, }); }, });