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

PanelChrome: Fix issue with empty panel after adding a non data panel and coming back from panel edit #34765

Merged
merged 2 commits into from May 27, 2021
Merged
Show file tree
Hide file tree
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
Expand Up @@ -49,6 +49,7 @@ export function discardPanelChanges(): ThunkResult<void> {
dispatch(setDiscardChanges(true));
};
}

export function exitPanelEditor(): ThunkResult<void> {
return async (dispatch, getStore) => {
const dashboard = getStore().dashboard.getModel();
Expand Down
13 changes: 11 additions & 2 deletions public/app/features/dashboard/dashgrid/PanelChrome.tsx
Expand Up @@ -302,14 +302,23 @@ export class PanelChrome extends Component<Props, State> {
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;
}

Expand Down