question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't call useFirestoreDoc or useFirestoreCollection with null query

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
jhuleattcommented, Mar 27, 2020

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.

0reactions
dannybarinshteincommented, Mar 28, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found