mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
Don't run query when control panel has errors (#14687)
This commit is contained in:
parent
877201f1e0
commit
281d637674
@ -107,12 +107,14 @@ export const DataTablesPane = ({
|
||||
onCollapseChange,
|
||||
chartStatus,
|
||||
ownState,
|
||||
errorMessage,
|
||||
}: {
|
||||
queryFormData: Record<string, any>;
|
||||
tableSectionHeight: number;
|
||||
chartStatus: string;
|
||||
ownState?: JsonObject;
|
||||
onCollapseChange: (openPanelName: string) => void;
|
||||
errorMessage?: JSX.Element;
|
||||
}) => {
|
||||
const [data, setData] = useState<{
|
||||
[RESULT_TYPES.results]?: Record<string, any>[];
|
||||
@ -196,6 +198,17 @@ export const DataTablesPane = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (panelOpen && isRequestPending[RESULT_TYPES.results]) {
|
||||
if (errorMessage) {
|
||||
setIsRequestPending(prevState => ({
|
||||
...prevState,
|
||||
[RESULT_TYPES.results]: false,
|
||||
}));
|
||||
setIsLoading(prevIsLoading => ({
|
||||
...prevIsLoading,
|
||||
[RESULT_TYPES.results]: false,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (chartStatus === 'loading') {
|
||||
setIsLoading(prevIsLoading => ({
|
||||
...prevIsLoading,
|
||||
@ -220,7 +233,14 @@ export const DataTablesPane = ({
|
||||
}));
|
||||
getData(RESULT_TYPES.samples);
|
||||
}
|
||||
}, [panelOpen, isRequestPending, getData, activeTabKey, chartStatus]);
|
||||
}, [
|
||||
panelOpen,
|
||||
isRequestPending,
|
||||
getData,
|
||||
activeTabKey,
|
||||
chartStatus,
|
||||
errorMessage,
|
||||
]);
|
||||
|
||||
const filteredData = {
|
||||
[RESULT_TYPES.results]: useFilteredTableData(
|
||||
@ -262,6 +282,9 @@ export const DataTablesPane = ({
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (errorMessage) {
|
||||
return <pre>{errorMessage}</pre>;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -285,6 +285,7 @@ const ExploreChartPanel = props => {
|
||||
tableSectionHeight={tableSectionHeight}
|
||||
onCollapseChange={onCollapseChange}
|
||||
chartStatus={props.chart.chartStatus}
|
||||
errorMessage={props.errorMessage}
|
||||
/>
|
||||
</Split>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user