Skip to content

Commit

Permalink
Merge pull request #5559 from mjattiot/patch-1
Browse files Browse the repository at this point in the history
Fix FilterListItem doesn't accept object values
  • Loading branch information
fzaninotto committed Nov 23, 2020
2 parents 6caea4b + 01bb0d5 commit 97f894d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { makeStyles } from '@material-ui/core/styles';
import CancelIcon from '@material-ui/icons/CancelOutlined';
import { useTranslate, useListFilterContext } from 'ra-core';
import { shallowEqual } from 'react-redux';
import isEqual from 'lodash/isEqual';

const useStyles = makeStyles(theme => ({
listItem: {
Expand Down Expand Up @@ -147,10 +148,7 @@ const FilterListItem: FC<{ label: string; value: any }> = props => {
const translate = useTranslate();
const classes = useStyles(props);

const isSelected = Object.keys(value).reduce(
(acc, key) => acc && value[key] == filterValues[key], // eslint-disable-line eqeqeq
true
);
const isSelected = isEqual(value, filterValues);

const addFilter = () => {
setFilters({ ...filterValues, ...value }, null, false);
Expand Down

0 comments on commit 97f894d

Please sign in to comment.