Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing abort error on dashboard #61279

Merged
merged 3 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
private domNode: any;
public readonly type = VISUALIZE_EMBEDDABLE_TYPE;
private autoRefreshFetchSubscription: Subscription;
private abortController?: AbortController;

constructor(
timefilter: TimefilterContract,
Expand Down Expand Up @@ -322,9 +323,14 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
},
uiState: this.vis.uiState,
};
if (this.abortController) {
this.abortController.abort();
}
this.abortController = new AbortController();
this.expression = await buildPipeline(this.vis, {
timefilter: this.timefilter,
timeRange: this.timeRange,
abortSignal: this.abortController!.signal,
});

if (this.handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ export const buildPipeline = async (
params: {
timefilter: TimefilterContract;
timeRange?: any;
abortSignal?: AbortSignal;
}
) => {
const { indexPattern, searchSource } = vis.data;
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/expressions/public/render_error_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const renderErrorHandler: RenderErrorHandlerFnType = (
error: RenderError,
handlers: IInterpreterRenderHandlers
) => {
if (error.name === 'AbortError') {
handlers.done();
return;
}

getNotifications().toasts.addError(error, {
title: i18n.translate('expressions.defaultErrorRenderer.errorTitle', {
defaultMessage: 'Error in visualisation',
Expand Down