diff --git a/services/web/frontend/js/infrastructure/fetch-json.ts b/services/web/frontend/js/infrastructure/fetch-json.ts index 2ebdf577dc..bfcc0f7f65 100644 --- a/services/web/frontend/js/infrastructure/fetch-json.ts +++ b/services/web/frontend/js/infrastructure/fetch-json.ts @@ -153,6 +153,11 @@ function fetchJSON( } }, error => { + // swallow the error if the fetch was cancelled (e.g. by cancelling an AbortController on component unmount) + if (swallowAbortError && error.name === 'AbortError') { + // the fetch request was aborted while reading/parsing the response body + return + } // parsing the response body failed reject( new FetchError( @@ -168,6 +173,7 @@ function fetchJSON( error => { // swallow the error if the fetch was cancelled (e.g. by cancelling an AbortController on component unmount) if (swallowAbortError && error.name === 'AbortError') { + // the fetch request was aborted before a response was returned return } // the fetch failed