I have a very straight forward use-case, where a user is able to upload profile pictures of himself and the URL will be saved within the corresponding user's entry in Firestore. Is there a best practice to handle issues regarding atomicity?
Let's say, the user uploads the image and during the process he loses connection or the app crashes, the result will be the file in the Storage but no connection to said file in the user data (if the crash happens exactly after the upload but before the Firestore write).
I considered either using transactions to do so, or implement a Cloud Function trigger, which listens on the storage and handles updating the user profile.
Is there maybe even a way to handle said issue with Firestore rules?
In my concrete app, there are many large images I need to handle, this is why I want to process as much stuff as possible on the client side, but still avoid having huge "dead" images in my database.