From d2ae5927099d0e8e1630ba029a1268fa3ab30680 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Wed, 21 Jun 2023 10:14:27 -0700 Subject: [PATCH] Only fetch vislayers when in dashboard context Signed-off-by: Tyler Ohlsen --- .../public/embeddable/visualize_embeddable.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts index 505c7b045cb4..3682c615d08c 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts @@ -62,7 +62,7 @@ import { VIS_EVENT_TO_TRIGGER } from './events'; import { VisualizeEmbeddableFactoryDeps } from './visualize_embeddable_factory'; import { TriggerId } from '../../../ui_actions/public'; import { SavedObjectAttributes } from '../../../../core/types'; -import { AttributeService } from '../../../dashboard/public'; +import { AttributeService, DASHBOARD_CONTAINER_TYPE } from '../../../dashboard/public'; import { SavedVisualizationsLoader } from '../saved_visualizations'; import { SavedAugmentVisLoader, @@ -417,8 +417,13 @@ export class VisualizeEmbeddable this.abortController = new AbortController(); const abortController = this.abortController; - // By waiting for this to complete, this.visLayers will be populated - await this.populateVisLayers(); + // By waiting for this to complete, this.visLayers will be populated. + // Note we only fetch when in the context of a dashboard - we do not + // show events or have event functionality when in the vis edit view. + const isInDashboard = this.parent?.type === DASHBOARD_CONTAINER_TYPE; + if (isInDashboard) { + await this.populateVisLayers(); + } this.expression = await buildPipeline(this.vis, { timefilter: this.timefilter,