[Discover] hide cancelled request error (#137690)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Dmitry Tomashevich 2022-08-03 17:19:36 +03:00 committed by GitHub
parent 05f2072586
commit dcdb7ca6dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,6 +165,7 @@ export class SavedSearchEmbeddable
const { searchSource } = this.savedSearch;
const prevAbortController = this.abortController;
// Abort any in-progress requests
if (this.abortController) this.abortController.abort();
this.abortController = new AbortController();
@ -266,7 +267,8 @@ export class SavedSearchEmbeddable
this.searchProps!.totalHitCount = resp.hits.total as number;
this.searchProps!.isLoading = false;
} catch (error) {
if (!this.destroyed) {
const cancelled = !!prevAbortController?.signal.aborted;
if (!this.destroyed && !cancelled) {
this.updateOutput({
...this.getOutput(),
loading: false,