Filter doesn't work with nested objects (Firestore maps)
See original GitHub issuereact-admin has the ability to use a reference to a Firestore map by using something like:
<TextField source="author.firstName" />
(as briefly documented in the docs).
or
<ReferenceField label="Organization" source="organization.id" reference="organizations">
When trying to do this with a filter, it doesn’t work.
const ProgramFilter = (props) => (
<Filter {...props}>
<ReferenceInput label="Organization" source="organization.id" reference="organizations" allowEmpty>
<SelectInput optionText="name" />
</ReferenceInput>
</Filter>
);
This is the URL that’s generated when the above filter is applied:
http://localhost:3000/programs?filter=%7B%22organization%22%3A%7B%22id%22%3A%22ZxaE6XPDbMQWkeADrUYs%22%7D%7D&order=ASC&page=1&perPage=10&sort=id
And the decoded version:
http://localhost:3000/programs?filter={"organization":{"id":"ZxaE6XPDbMQWkeADrUYs"}}&order=ASC&page=1&perPage=10&sort=id
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
How to query nested objects in firestore - Stack Overflow
Since August 2018 there is the new array_contains operator which allows filtering based on array values.
Read more >Add a Firestore document using a nested map | Google Cloud
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser. Was this helpful?
Read more >Reduce index costs with map fields | Firestore - Firebase
This page describes how to use a map field to manage index settings for a group of subfields. As a best practice, you...
Read more >Topics tagged map - AppGyver forums
Topic Replies Views Activity
Embedded map view · Bug · map , marketplace 3 60 December 12, 2022
Embedded Map view crash · Bug ·...
Read more >Cloud Firestore - React Native Firebase
Installation and getting started with Firestore. ... arrays (lists) and objects (maps) along with specific Cloud Firestore data such as Timestamps, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@benwinding That works. As always, thanks for your help!
Hi @dhstack,
Hopefully this fixes the problem for using nested filters. It accesses the deep object field using dot path notation, like you mentioned above:
Should be deployed in version
3.1.15
Here’s the unit-tests for it, let me know if this works for you:
https://github.com/benwinding/react-admin-firebase/blob/cd2a6842e2d8bdb76cb057eba4e06e387944e88e/tests/arrayHelpers.filtering.spec.ts#L92-L102