Skip to content

Commit

Permalink
[Visualize] Do not display a toast about missing provider when error …
Browse files Browse the repository at this point in the history
…is displayed (#189866)

## Summary

To reproduce:
1. Trigger an error on visualize visualization on the dashboard. A quick
way of doing it would be just to import this saved object, that creates
a visualization on a field that doesn't exist.
2. This toast appears:
<img width="1142" alt="Screenshot 2024-08-05 at 11 44 48"
src="https://github.com/user-attachments/assets/e6d945f6-a53d-403e-a898-77f76de5494b">



[test_toast_bug.json](https://github.com/user-attachments/files/16493961/test_toast_bug.json)


This PR fixes it (doesn't display the toast). Should we backport? 🤔
  • Loading branch information
mbondyra authored Aug 6, 2024
1 parent 13b15bd commit 3cf66e1
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,20 +527,27 @@ export class VisualizeEmbeddable
}

private renderError(error: ErrorLike | string) {
const { core } = this.deps.start();
if (isFallbackDataView(this.vis.data.indexPattern)) {
return (
<VisualizationMissedSavedObjectError
renderMode={this.input.renderMode ?? 'view'}
savedObjectMeta={{
savedObjectType: this.vis.data.savedSearchId ? 'search' : DATA_VIEW_SAVED_OBJECT_TYPE,
}}
application={getApplication()}
message={typeof error === 'string' ? error : error.message}
/>
<KibanaRenderContextProvider {...core}>
<VisualizationMissedSavedObjectError
renderMode={this.input.renderMode ?? 'view'}
savedObjectMeta={{
savedObjectType: this.vis.data.savedSearchId ? 'search' : DATA_VIEW_SAVED_OBJECT_TYPE,
}}
application={getApplication()}
message={typeof error === 'string' ? error : error.message}
/>
</KibanaRenderContextProvider>
);
}

return <VisualizationError error={error} />;
return (
<KibanaRenderContextProvider {...core}>
<VisualizationError error={error} />
</KibanaRenderContextProvider>
);
}

public destroy() {
Expand Down

0 comments on commit 3cf66e1

Please sign in to comment.