diff --git a/public/app/features/dashboard/dashgrid/PanelChrome.tsx b/public/app/features/dashboard/dashgrid/PanelChrome.tsx index 2a454691d810d..c69e7be0c4e63 100644 --- a/public/app/features/dashboard/dashgrid/PanelChrome.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChrome.tsx @@ -48,6 +48,7 @@ export interface State { export class PanelChrome extends PureComponent { timeSrv: TimeSrv = getTimeSrv(); querySubscription: Unsubscribable; + delayedStateUpdate: Partial; constructor(props: Props) { super(props); @@ -118,7 +119,15 @@ export class PanelChrome extends PureComponent { } } - this.setState({ isFirstLoad, errorMessage, data }); + const stateUpdate = { isFirstLoad, errorMessage, data }; + + if (this.isVisible) { + this.setState(stateUpdate); + } else { + // if we are getting data while another panel is in fullscreen / edit mode + // we need to store the data but not update state yet + this.delayedStateUpdate = stateUpdate; + } }, }; @@ -162,9 +171,15 @@ export class PanelChrome extends PureComponent { }; onRender = () => { - this.setState({ - renderCounter: this.state.renderCounter + 1, - }); + const stateUpdate = { renderCounter: this.state.renderCounter + 1 }; + + // If we have received a data update while hidden copy over that state as well + if (this.delayedStateUpdate) { + Object.assign(stateUpdate, this.delayedStateUpdate); + this.delayedStateUpdate = null; + } + + this.setState(stateUpdate); }; onOptionsChange = (options: any) => {