I have an idea to keep firebase costs down, but I’m curious what you all think its the best way to implement it.
Let’s say you have 200 records in a firestore database.
When you mount the page you GET all of those records and set to a data variable (pretty standard).
If then you were to update a record, unfortunately you need to GET and set again to refresh the list. That’s another 200 reads. Not a huge deal, but you only get 50,000 a day for free. So it could be a big deal if you have large databases and lots of users. If figure I can only have about 10 users without exceeding that limit. Then it gets real expensive, real fast.
GET all records from Data on every page mount. Set to a separate client local Data Variable.
Show the local data in the repeating list.
When you update a record, update both the local and the Firestore data sets.
Unfortunately if you do this, you need to pull the data every time you open that page. I don’t think it keeps the Data Variable across pages.
Which leads me to option 2
GET all records once. Set to an App Variable list of objects .
Show the App Variable list in the repeating list.
When you update a record, update both the App Variable and the Firestore data.
You’d have to do some real gymnastics to make this work, but you’d only need to pull all the records once per session.
Do you think there would be a performance impact in keeping a reasonably sized list in app.var memory rather than in a data variable?
GET all records on page mount. Set to a Data Variable as is typical.
Show the Firestore data in the repeating list.
When you update a record, update both just the Data Variable record and just the actual Firestore data record. That way don’t have to get the full set of records again. I don’t know how to change just one record in the Data Variable without changine the firestore data and have the list refresh. I also don’t know if you can update a record without getting a full response (and so the 200 reads again). So this doesn’t seem to work.
I learn how pagination and indexes work and have the user refresh as necessary. But without either pull to refresh or infinite lists this isn’t great either.
There must be a better way to do this than the standard. At the scale I want to run my app, the costs of the way the firestore connector operates would make the whole project unfeasible.