QueryEditorRow: Only pass error to query editor if panel is not loading (#56350)

This commit is contained in:
Kevin Yu 2022-10-05 12:19:49 -07:00 committed by GitHub
parent 97d19830cf
commit b3087cfcd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -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', () => {

View File

@ -534,8 +534,8 @@ export interface AngularQueryComponentScope<TQuery extends DataQuery> {
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,