reactfire icon indicating copy to clipboard operation
reactfire copied to clipboard

Indexed Collection Group Query produces infinite loop

Open JoFont opened this issue 4 years ago • 2 comments

Hello, good afternoon.

I don't know if I'm missing something but subscribing to an indexed collectionGroup returns an infinite loop. It also doesn't trigger the usual Firestore error to index this query when one does not exist. I had to manually trigger a .get() using the firebase js API in order to get the url to create the index.

After successful indexing, I can use this query with the JS API but using with the ReactFire API sends the app in an infinite loop.

React: 0.0.0-experimental-27659559e Firebase: ^8.2.5 ReactFire: ^3.0.0-rc.0

Steps to reproduce

  const tDate = moment().subtract(12, 'hours');
  const solarTelemetryRef = useFirestore().collectionGroup('telemetry').where('meta.createdAt', '>=', tDate.toDate());
  const { data: telemetryData } = useFirestoreCollectionData(solarTelemetryRef);

Please to let me know if this issue does not comply with the template and I'll make sure to provide more details.

Thank you very much for your help. All the best, Diogo Marques

JoFont avatar Mar 21 '21 15:03 JoFont

@JoFont I've had indefinite loop/suspending issues as well with v3.0.0-rc.*. They manifested at different times at different places in my app. I managed to get it working, not sure what the root cause is though. Maybe give my workaround a try and see if it solves your issues as well. For more details, see: https://github.com/FirebaseExtended/reactfire/issues/405#issuecomment-884860980.

steurt avatar Jul 22 '21 12:07 steurt

Hey @steurt, your solution seems to have mitigated the problem. Thank you very much 😁

JoFont avatar Aug 05 '21 11:08 JoFont