diff --git a/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx b/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx index f0390639d91..efa1326d6ae 100644 --- a/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx +++ b/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx @@ -199,8 +199,9 @@ class PromQueryField extends React.PureComponent { let query; if (selectedOptions.length === 1) { - if (selectedOptions[0].children.length === 0) { - query = selectedOptions[0].value; + const selectedOption = selectedOptions[0]; + if (!selectedOption.children || selectedOption.children.length === 0) { + query = selectedOption.value; } else { // Ignore click on group return;