react-admin-firebase
react-admin-firebase copied to clipboard
Lazy load Firebase error
When I enable lazyLoading in the version 3.2.17 of react-admin-firebase, I get this error on the list view:
"FirebaseError: [code=invalid-argument]: Function Query.where() called with invalid data. Unsupported field value: a function"
I originally got this error with: Firebase: 7.24.0 React Admin: 3.10.2 React Admin Firebase: 3.2.17
So I updated and still got this error with: Firebase: 8.2.4 React Admin: 3.11.4 React Admin Firebase: 3.2.17
Any idea what's going on?
Same problem here
Hmm sorry for the late response @dhstack @VihG , That firebase error occurs when a function somehow passed into the Dataprovider query, instead of a string field name. Can you please provide some more context on how you reproduce the error? Cheers, Ben
Hello @benwinding
Im my case the message error is
FirebaseError: [code=invalid-argument]: Function Query.where() called with invalid data. Unsupported field value: undefined
In my application I have multiple users and I need to filter through the records that each user has created. For this I am using the permanent filter of the List component. If I remove this filter the error does not happen.
<List {...props} filter={{ userId }}>
ps: Besides that, the lazyLoading works great and now i can add firebase rules to garantee that one user can't see another user record!
@VihG Thanks for pointing me in the right direction.
@benwinding I too am having the issue only when using the permanent filter in the list component. After temporarily removing it, I didn't get the error anymore.
filter={{
collectionQuery: (collection) =>
collection.orderBy('lastUpdated', 'desc'),
}}
This is the error I get in the UI:

This is the error I get in the console:

We are also having the very same issue.
@benwinding We are utilising a collectionQuery inside the initial filter passed into the <List> component.
What steps should be taken here when using lazy loading? Thank you for your support.