Can't call useFirestoreDoc or useFirestoreCollection with null query
See original GitHub issueThe PR merged in FirebaseExtended/reactfire#167 broke the ability to call useFirestoreDoc
and useFirestoreCollection
with a null query. This is useful to accommodate where dependencies hadn’t been calculated yet.
For example:
const user = useUser();
const doc = useFirestoreDoc(
user ? firebase.firestore().collection('x').doc(user.uid) : null
);
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
Firestore null query returns non-nullable field - Stack Overflow
I can't find any document describing why things implemented this way. But I'm guessing that sending isEqualTo / isNotEqualTo with null is ...
Read more >reactfire - npm
We need to do this because useFirestoreDoc throws a Promise while it is waiting for a response from Firestore. Suspense will catch the...
Read more >Missing Data – Databases and SQL
Databases use a special value called NULL to represent missing information. Almost all operations on NULL produce NULL. Queries can test for NULLs...
Read more >ReactFire - BestofReactjs
Can't call useFirestoreDoc or useFirestoreCollection with null query. The PR merged in FirebaseExtended/reactfire#167 broke the ability to call ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @dannybarinshtein, sorry for the delay. Any chance you can provide a pared-down code sample to demonstrate? I think I understand you use case, and I’m pretty sure that the better solution is still to break things out into different components instead of passing a null query to
useFirestoreDoc
, but having a concrete example would make it easier to discuss.Mid writing up an example here I started to agree with you that it might be best to separate into smaller components.
Lets disregard this 😃 thanks for the feedback!