diff --git a/assets/js/sync/index.js b/assets/js/sync/index.js index 17c083eaa9..e5f730f3eb 100644 --- a/assets/js/sync/index.js +++ b/assets/js/sync/index.js @@ -358,7 +358,13 @@ export const SyncProvider = ({ * @returns {void} */ () => { - cancelIndex().then(syncStopped); + cancelIndex() + .then(syncStopped) + .catch((error) => { + if (error?.name !== 'AbortError') { + throw error; + } + }); }, [cancelIndex, syncStopped], ); diff --git a/assets/js/sync/src/hooks.js b/assets/js/sync/src/hooks.js index 1fdf47d7ca..71a967d07b 100644 --- a/assets/js/sync/src/hooks.js +++ b/assets/js/sync/src/hooks.js @@ -125,13 +125,7 @@ export const useIndex = (apiUrl, nonce) => { * @returns {Promise} Current request promise. */ (url, options) => { - try { - request.current = fetch(url, options).then(onResponse).finally(onComplete); - } catch (error) { - if (error?.name !== 'AbortError') { - throw error; - } - } + request.current = fetch(url, options).then(onResponse).finally(onComplete); return request.current; },