New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useFirestoreCollection triggers a double render #484
Comments
Hi @maxprilutskiy, my first thought is that this might be Firestore first returning locally cached data, and then later returning data from the server. Does Also, just to check, does anything else in the |
I think I'm also seeing a double render for useUser as well 🙂 |
@jhuleatt Checked - nothings seems to be different. When will you guys have some time to fix this? |
You're getting multiple renders because Reactfire updates the status, it goes from The way I handle this is by checking the status:
|
Hi,
Seems like
useFirestoreCollection
always triggers unnecessary render when fetching data (suspense is on). Similar behavior is also the case foruseUser
.There's a chance I'm simply using the API wrong, so please advise if so :)
Version info
React: 17.0.2
Firebase: 9.1.3
ReactFire: 4.2.0
Test case
Expected behavior
console.log
is called once.Actual behavior
console.log
is called twice.Ultimately, what I'm trying to achieve is a code similar to the one below
that renders only once when the data is fetched (and then only when there're changes in the collection).
The text was updated successfully, but these errors were encountered: