mirror of
https://github.com/apache/superset.git
synced 2024-09-16 02:29:39 -04:00
fix(native-filters): default value not populated on second opening (#14401)
This commit is contained in:
parent
b38aadf9e4
commit
4410fd047e
@ -124,19 +124,7 @@ export const FiltersConfigForm: React.FC<FiltersConfigFormProps> = ({
|
||||
const forceUpdate = useForceUpdate();
|
||||
const [datasetDetails, setDatasetDetails] = useState<Record<string, any>>();
|
||||
|
||||
// make sure the formFilter is populated
|
||||
if (!form.getFieldValue('filters')) {
|
||||
setNativeFilterFieldValues(form, filterId, filterToEdit || {});
|
||||
forceUpdate();
|
||||
}
|
||||
const formFilter = form.getFieldValue('filters')[filterId];
|
||||
|
||||
useEffect(() => {
|
||||
setNativeFilterFieldValues(form, filterId, {
|
||||
defaultValue: filterToEdit?.defaultValue,
|
||||
});
|
||||
forceUpdate();
|
||||
}, [form, forceUpdate, filterId, filterToEdit?.defaultValue]);
|
||||
const formFilter = form.getFieldValue('filters')?.[filterId] || {};
|
||||
|
||||
const nativeFilterItems = getChartMetadataRegistry().items;
|
||||
const nativeFilterVizTypes = Object.entries(nativeFilterItems)
|
||||
|
@ -45,11 +45,4 @@ export const useBackendFormUpdate = (
|
||||
forceUpdate,
|
||||
filterId,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
setNativeFilterFieldValues(form, filterId, {
|
||||
defaultValue: formFilter?.defaultValue,
|
||||
});
|
||||
forceUpdate();
|
||||
}, [form, formFilter?.defaultValue, forceUpdate, filterId]);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user