mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelChrome: Fix issue with empty panel after adding a non data panel and coming back from panel edit (#34765)
* PanelChrome: Fix issue with empty panel after adding a non data panel and coming back from panel edit * Removed the console.log
This commit is contained in:
parent
67028af99e
commit
ca79d08dd8
@ -49,6 +49,7 @@ export function discardPanelChanges(): ThunkResult<void> {
|
|||||||
dispatch(setDiscardChanges(true));
|
dispatch(setDiscardChanges(true));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function exitPanelEditor(): ThunkResult<void> {
|
export function exitPanelEditor(): ThunkResult<void> {
|
||||||
return async (dispatch, getStore) => {
|
return async (dispatch, getStore) => {
|
||||||
const dashboard = getStore().dashboard.getModel();
|
const dashboard = getStore().dashboard.getModel();
|
||||||
|
@ -302,14 +302,23 @@ export class PanelChrome extends Component<Props, State> {
|
|||||||
return loadingState === LoadingState.Done || pluginMeta.skipDataQuery;
|
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) {
|
renderPanel(width: number, height: number) {
|
||||||
const { panel, plugin, dashboard } = this.props;
|
const { panel, plugin, dashboard } = this.props;
|
||||||
const { renderCounter, data, isFirstLoad } = this.state;
|
const { renderCounter, data } = this.state;
|
||||||
const { theme } = config;
|
const { theme } = config;
|
||||||
const { state: loadingState } = data;
|
const { state: loadingState } = data;
|
||||||
|
|
||||||
// do not render component until we have first data
|
// do not render component until we have first data
|
||||||
if (isFirstLoad && (loadingState === LoadingState.Loading || loadingState === LoadingState.NotStarted)) {
|
if (this.skipFirstRender(loadingState)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user