mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Fix Fetch controller.abort(reason) handling #1220
This commit is contained in:
parent
a3bb108b33
commit
4c5f19579c
2 changed files with 3 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ abort = (sAction, sReason, bClearOnly) => {
|
||||||
oRequests[sAction] = null;
|
oRequests[sAction] = null;
|
||||||
if (controller) {
|
if (controller) {
|
||||||
clearTimeout(controller.timeoutId);
|
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 => {
|
}).catch(err => {
|
||||||
clearTimeout(controller.timeoutId);
|
clearTimeout(controller.timeoutId);
|
||||||
err.aborted = signal.aborted;
|
err.aborted = signal.aborted;
|
||||||
err.reason = signal.reason;
|
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -165,7 +164,7 @@ export class AbstractFetchRemote
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error({fetchError:err});
|
console.error({fetchError:err});
|
||||||
fCallback && fCallback(
|
fCallback && fCallback(
|
||||||
'TimeoutError' == err.reason ? 3 : (err.name == 'AbortError' ? 2 : 1),
|
'TimeoutError' == err.name ? 3 : (err.name == 'AbortError' ? 2 : 1),
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
|
||||||
fCallback = (iError, oData, bCached) => {
|
fCallback = (iError, oData, bCached) => {
|
||||||
let error = '';
|
let error = '';
|
||||||
if (iError) {
|
if (iError) {
|
||||||
if ('reload' != oData?.reason) {
|
if ('reload' != oData?.name) {
|
||||||
error = getNotification(iError);
|
error = getNotification(iError);
|
||||||
MessagelistUserStore.loading(false);
|
MessagelistUserStore.loading(false);
|
||||||
// if (Notifications.RequestAborted !== iError) {
|
// if (Notifications.RequestAborted !== iError) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue