Hi,
I'm currently working on migrating a web application built with couchbase and sync gateway to use Firestore (and Firebase in general) instead. I am stuck on how to effectively cache user data for performance and cost. This seems like it would be a common problem so I wanted to know if there are any known patterns for handling this with Firestore.
As an example, in one component I display a chart that shows data for users across a specified timeframe. This chart could contain data for a hundred users and the timeframe can be changed. So I can't use snapshot listeners because it would go over 100 listeners easily and when the timeframe gets changed the query will change so all the listeners will be invalidated, but if the new timeframe includes some of the original data I wouldn't want to re-retrieve everything.
For some background, my team is trying to migrate from Couchbase to Firestore. With couchbase we could use couchbaselite and sync gateway to fully manage our offline cache on our app, and use the sync gateway changes feed to manage an in-memory cache on the web. It initially seemed like the Firestore offline cache could do effectively the same thing but after researching it more and working with it I've found that it's much more limited in functionality and storage. There are a lot of advantages with the Firebase ecosystem so we really want to use it, but this is a big hurdle for us since it seems like Firestore simply wouldn't be appropriate for the amount of data our applications use.