A platform for community discussion. Free, open, simple.
FIX: Composer doesn't show an error message in case of a network issue and stops updating draft after (#13268)
Andrei Prigorshnev476dfaed2f55
diff --git a/app/assets/javascripts/discourse/app/lib/ajax.js b/app/assets/javascripts/discourse/app/lib/ajax.jsindex a47ed559dee..48b690c8450 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 modeif (textStatus === "error" && isTesting()) {throw errorThrown;diff --git a/app/assets/javascripts/discourse/app/models/draft.js b/app/assets/javascripts/discourse/app/models/draft.jsindex 5406c7f9b88..37dda0ba765 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,});},});