Infinite request loop in useFirestoreCollection
Hello,
the following code results in an infinite loop when user isn't authenticated aka user.data is undefined. Is this expected?
const user = useUser(undefined, { suspense: true });
const subscriptions = useFirestoreCollection(
firestore
.collection('customers')
.doc(user.data?.uid)
.collection('subscriptions')
When something random and non-existent is passed to doc(myId), it throws Missing or insufficient permissions, when null is passed it throws Function CollectionReference.doc() cannot be called with an empty path, however when undefined is passed the code goes into an infinite loop and triggers hundreds of requests per second.
Hi, did you solve your problem? If yes, could you help me?
@prilutskiy 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.