I have an app where all data shown to the user is received from firestore documents. These documents consists of either user generated content or data that's been imported from 3rd party APIs. The imported documents contains an expiration timestamp. Each screen in the app is mapped to one or more firestore document paths.
If the app requests and subscribes to a document at a specific path, and that document is not found, or its expiration has been reached, I want a cloud function to (re)import the document from the external API, so I can be sure that the updated data will appear in the app shortly.
However, I cannot find a trigger for document read or not found operations, which would have been the obvious choice.
Without being able to trigger functions on reads, what are the alternative solutions here?
I'm using react/redux/firestoreConnect for getting the data.