diff --git a/public/app/features/query/components/QueryEditorRow.test.ts b/public/app/features/query/components/QueryEditorRow.test.ts index cc03790c24f..0e2670eb5e4 100644 --- a/public/app/features/query/components/QueryEditorRow.test.ts +++ b/public/app/features/query/components/QueryEditorRow.test.ts @@ -109,6 +109,21 @@ describe('filterPanelDataToQuery', () => { const panelDataA = filterPanelDataToQuery(loadingData, 'A'); expect(panelDataA?.state).toBe(LoadingState.Loading); }); + + it('should not set the state to error if the frame is still loading', () => { + const loadingData: PanelData = { + state: LoadingState.Loading, + series: [], + error: { + refId: 'B', + message: 'Error', + }, + timeRange: { from: dateTime(), to: dateTime(), raw: { from: 'now-1d', to: 'now' } }, + }; + + const panelDataA = filterPanelDataToQuery(loadingData, 'A'); + expect(panelDataA?.state).toBe(LoadingState.Loading); + }); }); describe('frame results with warnings', () => { diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index 629338f3e57..13c9b5fd521 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -534,8 +534,8 @@ export interface AngularQueryComponentScope { export function filterPanelDataToQuery(data: PanelData, refId: string): PanelData | undefined { const series = data.series.filter((series) => series.refId === refId); - // If there was an error with no data, pass it to the QueryEditors - if (data.error && !data.series.length) { + // If there was an error with no data and the panel is not in a loading state, pass it to the QueryEditors + if (data.state !== LoadingState.Loading && data.error && !data.series.length) { return { ...data, state: LoadingState.Error,