fix: view filter and group by types
This commit is contained in:
parent
f95625f20d
commit
71df89c81e
@ -57,7 +57,7 @@ const FilterControl = ({
|
||||
}}
|
||||
>
|
||||
{viewFilters.map(viewFilter => {
|
||||
const checked = filter[viewFilter.id]?.active ?? false;
|
||||
const checked = Boolean(viewFilter.id && filter[viewFilter?.id]?.active) ?? false;
|
||||
const labelId = `filter-list-label-${viewFilter.label}`;
|
||||
return (
|
||||
<MenuItem
|
||||
|
@ -692,14 +692,14 @@ export type Field<EF extends BaseField = UnknownField> =
|
||||
| EF;
|
||||
|
||||
export interface ViewFilter {
|
||||
id: string;
|
||||
id?: string;
|
||||
label: string;
|
||||
field: string;
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
export interface ViewGroup {
|
||||
id: string;
|
||||
id?: string;
|
||||
label: string;
|
||||
field: string;
|
||||
pattern?: string;
|
||||
|
@ -405,6 +405,10 @@ function entries(
|
||||
const payload = action.payload;
|
||||
const { collection, filter: viewFilter } = payload;
|
||||
|
||||
if (!viewFilter.id) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const filter = {
|
||||
...state.filter,
|
||||
};
|
||||
@ -434,6 +438,10 @@ function entries(
|
||||
const payload = action.payload;
|
||||
const { collection, filter: viewFilter } = payload;
|
||||
|
||||
if (!viewFilter.id) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const filter = {
|
||||
...state.filter,
|
||||
};
|
||||
@ -468,6 +476,10 @@ function entries(
|
||||
const payload = action.payload;
|
||||
const { collection, group: groupBy } = payload;
|
||||
|
||||
if (!groupBy.id) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const group = {
|
||||
...state.group,
|
||||
};
|
||||
@ -494,6 +506,10 @@ function entries(
|
||||
const payload = action.payload;
|
||||
const { collection, group: groupBy } = payload;
|
||||
|
||||
if (!groupBy.id) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const group = {
|
||||
...state.group,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user