Infinite request loop in useFirestoreCollection
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- firebase, react, typescript
Research direction
Reproduce the issue with the shown useUser and useFirestoreCollection snippet, then trace how useFirestoreCollection handles an undefined document path. Compare its behavior with null and a nonexistent id; done means the undefined case no longer causes repeated requests and has a defined outcome.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 403
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 11
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FirebaseExtended/reactfire
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
FirebaseExtended/reactfire#801 ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
FirebaseExtended/reactfire#793 ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FirebaseExtended/reactfire#790 · 2 comments ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
FirebaseExtended/reactfire#789 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
FirebaseExtended/reactfire#788 ·
Maintainers usually reply within 2 days
All issues in FirebaseExtended/reactfire
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openedx/frontend-app-authoring#3274 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area/documentation status/need-triage
Difficulty 1/5 Under an hour Newbie friendliness 95/100
google-gemini/gemini-cli#29548 ·
Maintainers usually reply within 1 day
-
sdk-typescript vector-store
Difficulty 2/5 Half a day Newbie friendliness 82/100
mem0ai/mem0#7495 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day