refactor: add response state to condition

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
This commit is contained in:
Laura Benz
2023-01-04 15:50:18 +01:00
committed by GitHub
co-authored by Piotr Jamróz
parent 1dfb9e0430
commit 0a167ab00b
@@ -81,7 +81,11 @@ export const QueryEditorField = ({ dsUid, invalid, error, name }: Props) => {
if (datasource) {
runRequest(datasource, transaction.request).subscribe((panelData) => {
if (!panelData || panelData.state === 'Error' || panelData.series.length === 0) {
if (
!panelData ||
panelData.state === 'Error' ||
(panelData.state === 'Done' && panelData.series.length === 0)
) {
setIsValidQuery(false);
} else if (
panelData.state === 'Done' &&