When updating or deleting documents or users in Cloud Firestore, it seems that Firebase caches these requests even in offline mode. How do I cancel these requests if there is a connection loss? I would rather not cache these updates as it would create a lot of problems in my app.
Below, it seems that no exceptions are caught when trying to execute this function in offline mode.
fun deleteUser(){
try {
val user = Firebase.auth.currentUser!!
val db = Firebase.firestore
db.collection("users").document(user.uid)
.delete().addOnCompleteListener() {
if (it.isSuccessful) {
user.delete()
.addOnCompleteListener { task ->
if (task.isSuccessful) {
Log.d(TAG, "User account deleted.")
}
}
}
}
} catch (e : Exception){
Log.d(TAG,e.toString())
e.printStackTrace()
}
}