mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: Unable to clear default value in native select filter (#14739)
This commit is contained in:
parent
0e86a6b81c
commit
173c486d4a
@ -21,6 +21,8 @@ import { FormInstance } from 'antd/lib/form';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CustomControlItem } from '@superset-ui/chart-controls';
|
import { CustomControlItem } from '@superset-ui/chart-controls';
|
||||||
|
|
||||||
|
const FILTERS_FIELD_NAME = 'filters';
|
||||||
|
|
||||||
export const useForceUpdate = () => {
|
export const useForceUpdate = () => {
|
||||||
const [, updateState] = React.useState({});
|
const [, updateState] = React.useState({});
|
||||||
return React.useCallback(() => updateState({}), []);
|
return React.useCallback(() => updateState({}), []);
|
||||||
@ -31,16 +33,19 @@ export const setNativeFilterFieldValues = (
|
|||||||
filterId: string,
|
filterId: string,
|
||||||
values: object,
|
values: object,
|
||||||
) => {
|
) => {
|
||||||
const formFilters = form.getFieldValue('filters') || {};
|
const formFilters = form.getFieldValue(FILTERS_FIELD_NAME) || {};
|
||||||
form.setFieldsValue({
|
form.setFields([
|
||||||
filters: {
|
{
|
||||||
...formFilters,
|
name: FILTERS_FIELD_NAME,
|
||||||
[filterId]: {
|
value: {
|
||||||
...formFilters[filterId],
|
...formFilters,
|
||||||
...values,
|
[filterId]: {
|
||||||
|
...formFilters[filterId],
|
||||||
|
...values,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getControlItems = (
|
export const getControlItems = (
|
||||||
|
Loading…
Reference in New Issue
Block a user