I’m building an application with Google Firebase and Firestore that has it’s structure defined in the DB.
This structure is not very big and doesn’t change all that often. This structure is stored in different collections based on hierarchy going something like domain > chapter > unit, where each item has a list of child Ids defined.
To prevent making a ton of DB calls for a structure that doesn’t change all that often I was thinking to keep every entity retrieved from the DB in the browsers localStorage as well as a version for the current application structure. On start it would compare the local version with the DB version and if they don’t match, discard the local version.
I’m thinking to make a collection called ‘system’ or something like that with (for now) a single record called something like ‘composition version’. Each time the structure changes, a cloud function should update this record.
So my question is: does this make sense or are there better ways of doing this in Firebase?