From 4c5f19579c2bd97fbad0850e1ff0ac92c5deac0d Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 21 Aug 2023 11:31:57 +0200 Subject: [PATCH] Fix Fetch controller.abort(reason) handling #1220 --- dev/Remote/AbstractFetch.js | 5 ++--- dev/Stores/User/Messagelist.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index afaf78e65..887312946 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -36,7 +36,7 @@ abort = (sAction, sReason, bClearOnly) => { oRequests[sAction] = null; if (controller) { clearTimeout(controller.timeoutId); - bClearOnly || controller.abort(sReason || 'AbortError'); + bClearOnly || controller.abort(new DOMException(sAction, sReason || 'AbortError')); } }, @@ -61,7 +61,6 @@ fetchJSON = (action, sUrl, params, timeout, jsonCallback) => { }).catch(err => { clearTimeout(controller.timeoutId); err.aborted = signal.aborted; - err.reason = signal.reason; return Promise.reject(err); }); }; @@ -165,7 +164,7 @@ export class AbstractFetchRemote .catch(err => { console.error({fetchError:err}); fCallback && fCallback( - 'TimeoutError' == err.reason ? 3 : (err.name == 'AbortError' ? 2 : 1), + 'TimeoutError' == err.name ? 3 : (err.name == 'AbortError' ? 2 : 1), err ); }); diff --git a/dev/Stores/User/Messagelist.js b/dev/Stores/User/Messagelist.js index 8cc2c364a..7c1be0697 100644 --- a/dev/Stores/User/Messagelist.js +++ b/dev/Stores/User/Messagelist.js @@ -222,7 +222,7 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach fCallback = (iError, oData, bCached) => { let error = ''; if (iError) { - if ('reload' != oData?.reason) { + if ('reload' != oData?.name) { error = getNotification(iError); MessagelistUserStore.loading(false); // if (Notifications.RequestAborted !== iError) {