FirebaseExtended / FirebaseExtended/reactfire
Infinite request loop in useFirestoreCollection
- 主要言語
- TypeScript
- スター
- 3.6k
- フォーク
- 403
- 平均マージ
- 14時間 53分
- マージ済み PR(30日)
- 5
説明
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.
コントリビューションガイド
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- firebase, react, typescript
- 領域
- databases, frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100