diff --git a/public/app/features/dashboard/components/PanelEditor/state/actions.ts b/public/app/features/dashboard/components/PanelEditor/state/actions.ts index b0b23b6681af..b7a309fb47f8 100644 --- a/public/app/features/dashboard/components/PanelEditor/state/actions.ts +++ b/public/app/features/dashboard/components/PanelEditor/state/actions.ts @@ -49,6 +49,7 @@ export function discardPanelChanges(): ThunkResult { dispatch(setDiscardChanges(true)); }; } + export function exitPanelEditor(): ThunkResult { return async (dispatch, getStore) => { const dashboard = getStore().dashboard.getModel(); diff --git a/public/app/features/dashboard/dashgrid/PanelChrome.tsx b/public/app/features/dashboard/dashgrid/PanelChrome.tsx index d5e01503f6df..086d75bec424 100644 --- a/public/app/features/dashboard/dashgrid/PanelChrome.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChrome.tsx @@ -302,14 +302,23 @@ export class PanelChrome extends Component { return loadingState === LoadingState.Done || pluginMeta.skipDataQuery; } + skipFirstRender(loadingState: LoadingState) { + const { isFirstLoad } = this.state; + return ( + this.wantsQueryExecution && + isFirstLoad && + (loadingState === LoadingState.Loading || loadingState === LoadingState.NotStarted) + ); + } + renderPanel(width: number, height: number) { const { panel, plugin, dashboard } = this.props; - const { renderCounter, data, isFirstLoad } = this.state; + const { renderCounter, data } = this.state; const { theme } = config; const { state: loadingState } = data; // do not render component until we have first data - if (isFirstLoad && (loadingState === LoadingState.Loading || loadingState === LoadingState.NotStarted)) { + if (this.skipFirstRender(loadingState)) { return null; }