react-admin-firebase icon indicating copy to clipboard operation
react-admin-firebase copied to clipboard

Lazy load Firebase error

Open davidstackio opened this issue 4 years ago • 5 comments

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?

davidstackio avatar Jan 28 '21 01:01 davidstackio

Same problem here

VihG avatar Feb 15 '21 00:02 VihG

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

benwinding avatar Feb 15 '21 00:02 benwinding

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 avatar Feb 15 '21 19:02 VihG

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

This is the error I get in the console: image

davidstackio avatar Feb 22 '21 04:02 davidstackio

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.

murat0 avatar Jul 12 '23 09:07 murat0