From 72736bd2a17d3824d20e35e3e8b2187664381900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 17 Dec 2020 13:30:55 +0100 Subject: [PATCH] PanelEdit: Update UI if panel plugin changes field config (#29898) --- .../dashboard/components/PanelEditor/PanelEditor.tsx | 7 +++---- public/app/features/dashboard/state/PanelModel.ts | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx index 6b4088aae2f..363d139343a 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx @@ -127,12 +127,11 @@ export class PanelEditorUnconnected extends PureComponent { }; onFieldConfigChange = (config: FieldConfigSource) => { - const { panel } = this.props; - - panel.updateFieldConfig({ + // we do not need to trigger force update here as the function call below + // fires PanelOptionsChangedEvent which we subscribe to above + this.props.panel.updateFieldConfig({ ...config, }); - this.forceUpdate(); }; onPanelOptionsChanged = (options: any) => { diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 6bbe807f9cf..ca5872e4a4a 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -223,6 +223,7 @@ export class PanelModel implements DataConfigSource { updateFieldConfig(config: FieldConfigSource) { this.fieldConfig = config; + this.events.publish(new PanelOptionsChangedEvent()); this.resendLastResult(); this.render();