grafana/public/app/features/explore/ResponseErrorContainer.tsx
Giordano Ricci d3450d75a4
Explore: URL migrations & improved state management (#69692)
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
2023-06-21 10:06:28 +01:00

22 lines
636 B
TypeScript

import React from 'react';
import { LoadingState } from '@grafana/data';
import { useSelector } from 'app/types';
import { ErrorContainer } from './ErrorContainer';
interface Props {
exploreId: string;
}
export function ResponseErrorContainer(props: Props) {
const queryResponse = useSelector((state) => state.explore.panes[props.exploreId]!.queryResponse);
const queryError = queryResponse?.state === LoadingState.Error ? queryResponse?.error : undefined;
// Errors with ref ids are shown below the corresponding query
if (queryError?.refId) {
return null;
}
return <ErrorContainer queryError={queryError} />;
}