Reputation: 219
I have created a simple firebase webapp, which is subscribed to listen for changes within a collection in firestore. As there are only 3 items in that collection, I was wondering how it was possible to reach the quota limit of 50k reads a day. I did leave the app running on localhost while I was away from my computer, which I am assuming is the reason that it reached the daily quota limit. But how was it possible to do that?
Basically, I have one page on my webapp that is subscribed to my collection in firestore. I then use that data retrieved to display it on the page.
As I said, there are only 3 items in the collection I am subscribed to. How does the subscription work? Is it constantly reading the database to watch for changes, or does it only do a read request when the collection changes (a doc being added or removed, for example)?
PS I have not even published this app to the web, so I don't think it's even possible for read requests to be coming from another computer.
Upvotes: 3
Views: 1432
Reputation: 11
i think you using map in setProducts make it re-render thus sending get call to firebase many time
Upvotes: 0
Reputation: 333
You got a loop there
useEffect
is triggered whenever products
changes, and you are calling setProducts in the useEffect
itself.
So i'm thinking that this has consumed all your daily quota.
Upvotes: 3