diff --git a/frontend/src/components/search/search.js b/frontend/src/components/search/search.js index f158d897e5..f75af15e49 100644 --- a/frontend/src/components/search/search.js +++ b/frontend/src/components/search/search.js @@ -8,7 +8,7 @@ import searchAPI from '../../utils/search-api'; import { gettext } from '../../utils/constants'; import SearchResultItem from './search-result-item'; import SearchResultLibrary from './search-result-library'; -import { debounce, Utils } from '../../utils/utils'; +import { debounce, Utils, isCanceled } from '../../utils/utils'; import toaster from '../toast'; import Loading from '../loading'; import { SEARCH_MASK, SEARCH_CONTAINER } from '../../constants/zIndexes'; @@ -414,8 +414,10 @@ class Search extends Component { isLoading: false, }); }).catch(error => { - let errMessage = Utils.getErrorMsg(error); - toaster.danger(errMessage); + if (!isCanceled(error)) { + let errMessage = Utils.getErrorMsg(error); + toaster.danger(errMessage); + } this.setState({ isLoading: false }); }); }; diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 66f91bc145..b101bdbfd3 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -1,3 +1,4 @@ +import axios from 'axios'; import { mediaUrl, gettext, serviceURL, siteRoot, isPro, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled, onlyofficeConverterExtensions, enableSeadoc, enableRepoSnapshotLabel, enableResetEncryptedRepoPassword, isEmailConfigured, isSystemStaff, enableOnlyoffice, onlyofficeEditFileExtension, @@ -1997,3 +1998,7 @@ export const throttle = (func, delay) => { export const getType = (value) => { return Object.prototype.toString.call(value).slice(8, -1); }; + +export const isCanceled = (error) => { + return axios.isCancel(error); +};