mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
fix(explore): Value undefined and Unhashable type errors (#22207)
This commit is contained in:
parent
888f43c6ad
commit
1809d2b957
@ -37,6 +37,7 @@ import {
|
|||||||
SupersetTheme,
|
SupersetTheme,
|
||||||
useTheme,
|
useTheme,
|
||||||
isDefined,
|
isDefined,
|
||||||
|
JsonValue,
|
||||||
} from '@superset-ui/core';
|
} from '@superset-ui/core';
|
||||||
import {
|
import {
|
||||||
ControlPanelSectionConfig,
|
ControlPanelSectionConfig,
|
||||||
@ -276,21 +277,36 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
|
|||||||
>(state => state.explore.controlsTransferred);
|
>(state => state.explore.controlsTransferred);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const removeDatasourceWarningFromControl = (
|
||||||
|
value: JsonValue | undefined,
|
||||||
|
) => {
|
||||||
|
if (
|
||||||
|
typeof value === 'object' &&
|
||||||
|
isDefined(value) &&
|
||||||
|
'datasourceWarning' in value
|
||||||
|
) {
|
||||||
|
return { ...value, datasourceWarning: false };
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
if (props.chart.chartStatus === 'success') {
|
if (props.chart.chartStatus === 'success') {
|
||||||
controlsTransferred?.forEach(controlName => {
|
controlsTransferred?.forEach(controlName => {
|
||||||
const alteredControls = ensureIsArray(
|
if (!isDefined(props.controls[controlName])) {
|
||||||
props.controls[controlName].value,
|
return;
|
||||||
).map(value => {
|
}
|
||||||
if (
|
if (Array.isArray(props.controls[controlName].value)) {
|
||||||
typeof value === 'object' &&
|
const alteredControls = ensureIsArray(
|
||||||
isDefined(value) &&
|
props.controls[controlName].value,
|
||||||
'datasourceWarning' in value
|
)?.map(removeDatasourceWarningFromControl);
|
||||||
) {
|
props.actions.setControlValue(controlName, alteredControls);
|
||||||
return { ...value, datasourceWarning: false };
|
} else {
|
||||||
}
|
props.actions.setControlValue(
|
||||||
return value;
|
controlName,
|
||||||
});
|
removeDatasourceWarningFromControl(
|
||||||
props.actions.setControlValue(controlName, alteredControls);
|
props.controls[controlName].value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
|
Loading…
Reference in New Issue
Block a user