From 0d7c97d4066427310eeade1015556df0eada2d6e Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 8 Oct 2019 09:56:16 -0700 Subject: [PATCH] Fix issue with angular scope not firing after setting state on vis --- .../interpreter/public/renderers/visualization.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/interpreter/public/renderers/visualization.ts b/src/legacy/core_plugins/interpreter/public/renderers/visualization.ts index 960e925b13221..a4cd95cd3bd57 100644 --- a/src/legacy/core_plugins/interpreter/public/renderers/visualization.ts +++ b/src/legacy/core_plugins/interpreter/public/renderers/visualization.ts @@ -30,13 +30,16 @@ export const visualization = () => ({ const { visData, visConfig, params } = config; const visType = config.visType || visConfig.type; const $injector = await chrome.dangerouslyGetActiveInjector(); + const $timeout = $injector.get('$timeout') as any; const Private = $injector.get('Private') as any; const Vis = Private(VisProvider); if (handlers.vis) { // special case in visualize, we need to render first (without executing the expression), for maps to work - if (visConfig) { - handlers.vis.setCurrentState({ type: visType, params: visConfig }); + if (visConfig && ['tile_map', 'region_map'].includes(visConfig.type)) { + $timeout(() => { + handlers.vis.setCurrentState({ type: visType, params: visConfig }); + }); } } else { handlers.vis = new Vis({