fix: view filter and group by types

This commit is contained in:
Daniel Lautzenheiser 2023-01-25 15:57:30 -05:00
parent f95625f20d
commit 71df89c81e
3 changed files with 19 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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,
};