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

Geomap: Update with template variable change #52007

Merged
merged 1 commit into from Jul 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions public/app/plugins/panel/geomap/GeomapPanel.tsx
Expand Up @@ -134,6 +134,10 @@ export class GeomapPanel extends Component<Props, State> {
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 */
Expand Down Expand Up @@ -259,8 +263,11 @@ export class GeomapPanel extends Component<Props, State> {
* 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);
}
}
}

Expand Down