fix(native-filters): Fix Select `Default First Value` by clicked `Clear All` (#15219)

* fix:fix get permission function

* fix: fix select first value by clear all

* lint: fix lint
This commit is contained in:
simcha90 2021-06-17 11:14:21 +03:00 committed by GitHub
parent e5187a479a
commit fe5381dcb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -92,7 +92,11 @@ const Header: FC<HeaderProps> = ({
const handleClearAll = () => {
filterValues.forEach(filter => {
setDataMaskSelected(draft => {
draft[filter.id] = getInitialDataMask(filter.id);
draft[filter.id] = getInitialDataMask(filter.id, {
filterState: {
value: null,
},
});
});
});
};

View File

@ -37,8 +37,11 @@ import {
import { areObjectsEqual } from '../reduxUtils';
import { Filters } from '../dashboard/reducers/types';
export function getInitialDataMask(id?: string): DataMask;
export function getInitialDataMask(id: string): DataMaskWithId {
export function getInitialDataMask(id?: string, moreProps?: DataMask): DataMask;
export function getInitialDataMask(
id: string,
moreProps: DataMask = {},
): DataMaskWithId {
let otherProps = {};
if (id) {
otherProps = {
@ -52,6 +55,7 @@ export function getInitialDataMask(id: string): DataMaskWithId {
value: undefined,
},
ownState: {},
...moreProps,
} as DataMaskWithId;
}