Commit 31e2b7e7 by Torkel Ödegaard Committed by GitHub

SharedQuery: Error when switching to -- Dashboard -- data source caused "no…

SharedQuery: Error when switching to -- Dashboard -- data source caused "no data" no matter what source panel was selected (#27627)

* SharedQuery: Error when switching to -- Dashboard -- data source made observable subscription error and subsequent data results not update visualization

* added null check just in case
parent c450ffd7
......@@ -93,11 +93,13 @@ export class PanelQueryRunner {
if (withFieldConfig) {
// Apply field defaults & overrides
const fieldConfig = this.dataConfigSource.getFieldOverrideOptions();
const timeZone = data.request?.timezone ?? 'browser';
if (fieldConfig) {
processedData = {
...processedData,
series: applyFieldOverrides({
timeZone: data.request!.timezone,
timeZone: timeZone,
autoMinMax: true,
data: processedData.series,
...fieldConfig,
......
......@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
import { QueryRunnerOptions } from 'app/features/dashboard/state/PanelQueryRunner';
import { DashboardQuery, SHARED_DASHBODARD_QUERY } from './types';
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
import { LoadingState, DefaultTimeRange, DataQuery, PanelData, DataSourceApi } from '@grafana/data';
import { LoadingState, DefaultTimeRange, DataQuery, PanelData, DataSourceApi, DataQueryRequest } from '@grafana/data';
export function isSharedDashboardQuery(datasource: string | DataSourceApi | null) {
if (!datasource) {
......@@ -70,6 +70,7 @@ function getQueryError(msg: string): PanelData {
return {
state: LoadingState.Error,
series: [],
request: {} as DataQueryRequest,
error: { message: msg },
timeRange: DefaultTimeRange,
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment