From 7e9194e6e2cbbbe74fcaaf534aa5cc5e336d8264 Mon Sep 17 00:00:00 2001 From: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com> Date: Fri, 8 Jul 2022 15:46:01 -0700 Subject: [PATCH] Geomap: update with template variable change (#52007) After componentDidUpdate, check for a data change and apply it. Fixes #51983 --- public/app/plugins/panel/geomap/GeomapPanel.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/geomap/GeomapPanel.tsx b/public/app/plugins/panel/geomap/GeomapPanel.tsx index 44ebe5871fc..addae884158 100644 --- a/public/app/plugins/panel/geomap/GeomapPanel.tsx +++ b/public/app/plugins/panel/geomap/GeomapPanel.tsx @@ -134,6 +134,10 @@ export class GeomapPanel extends Component { if (this.map && (this.props.height !== prevProps.height || this.props.width !== prevProps.width)) { this.map.updateSize(); } + // Check for a difference between previous data and component data + if (this.map && this.props.data !== prevProps.data) { + this.dataChanged(this.props.data); + } } /** This function will actually update the JSON model */ @@ -259,8 +263,11 @@ export class GeomapPanel extends Component { * Called when PanelData changes (query results etc) */ dataChanged(data: PanelData) { - for (const state of this.layers) { - this.applyLayerFilter(state.handler, state.options); + // Only update if panel data matches component data + if (data === this.props.data) { + for (const state of this.layers) { + this.applyLayerFilter(state.handler, state.options); + } } }