Fix Fetch controller.abort(reason) handling #1220

This commit is contained in:
the-djmaze 2023-08-21 11:31:57 +02:00
parent a3bb108b33
commit 4c5f19579c
2 changed files with 3 additions and 4 deletions

View file

@ -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
);
});

View file

@ -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) {