Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix FilterListItem doesn't accept object values #5559

Merged
merged 1 commit into from
Nov 23, 2020

Conversation

mjattiot
Copy link
Contributor

If the filter value is a nested object, the component is unable to find out if it is selected.

If the filter value is a nested object, the component is unable to find out if it is selected.
@fzaninotto
Copy link
Member

Could you give an example of the usage you're doing of nested object values?

@mjattiot
Copy link
Contributor Author

mjattiot commented Nov 23, 2020

Sure. Our filters are mongo queries that are serialized to a REST API. It looks like this :

<FilterList
        label="resources.goldens/disclosures.fields.marketData.DsclsrRspnDdln"
        icon={<AccessTimeIcon />}
    >
        <FilterListItem
            label="dates.filters.today"
            value={{
                $and: [
                    {
                        'marketData.IssrDsclsrDdln.Dt.Dt': {
                            $gte: { $date: startOfToday().toISOString() },
                        },
                    },
                    {
                        'marketData.IssrDsclsrDdln.Dt.Dt': {
                            $lte: { $date: endOfToday().toISOString() },
                        },
                    },
                ],
            }}
        />

@fzaninotto fzaninotto changed the title Allow a nested object value in FilterListItem Fix FilterListItem doesn't accept object values Nov 23, 2020
@fzaninotto fzaninotto merged commit 97f894d into marmelab:master Nov 23, 2020
@fzaninotto
Copy link
Member

Now I understand. Thanks!

@fzaninotto fzaninotto added this to the 3.10.3 milestone Nov 23, 2020
mjattiot added a commit to mjattiot/react-admin that referenced this pull request Dec 8, 2020
fzaninotto added a commit that referenced this pull request Dec 8, 2020
…is applied

Fixes a regression introduced by #5559
Added unit tests to avoid regressions in the future
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants