mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SQL Datasources: Fix variable throwing error if query returns no data (#65937)
* Fix SQL query variable throwing error if query returns no data * Tests to verify that metricFindQuery returns properly and doesn't throw error * Fix all codepaths that might throw errors because of undefined backendSrv response
This commit is contained in:
@@ -164,7 +164,7 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO
|
||||
.pipe(
|
||||
map((res: FetchResponse<BackendDataSourceResponse>) => {
|
||||
const rsp = toDataQueryResponse(res, queries);
|
||||
return rsp.data[0];
|
||||
return rsp.data[0] ?? { fields: [] };
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user