Histogram: Fix crash when state was undefined (when combine was enabled) (#34514) (#34520)

(cherry picked from commit d0769397b2)

Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
Grot (@grafanabot)
2021-05-27 10:59:57 +02:00
committed by GitHub
co-authored by Torkel Ödegaard
parent c3bc0a861f
commit 15c09dcd68
3 changed files with 10 additions and 7 deletions
+7 -5
View File
@@ -288,16 +288,18 @@ func getPanelSort(id string) int {
sort = 10
case "status-grid":
sort = 11
case "graph":
case "histogram":
sort = 12
case "text":
case "graph":
sort = 13
case "alertlist":
case "text":
sort = 14
case "dashlist":
case "alertlist":
sort = 15
case "news":
case "dashlist":
sort = 16
case "news":
sort = 17
}
return sort
}
@@ -57,7 +57,7 @@ export const VisualizationSelectPane: FC<Props> = ({ panel }) => {
const match = filterPluginList(plugins, query, plugin.meta);
if (match && match.length) {
onPluginTypeChange(match[0], true);
onPluginTypeChange(match[0], false);
}
}
},
@@ -123,7 +123,8 @@ const prepConfig = (frame: DataFrame, theme: GrafanaTheme2) => {
for (let i = 2; i < frame.fields.length; i++) {
const field = frame.fields[i];
field.state!.seriesIndex = seriesIndex++;
field.state = field.state ?? {};
field.state.seriesIndex = seriesIndex++;
const customConfig = { ...field.config.custom };