Skip to content

clear local firestore cache? #14596

Discussion options

You must be logged in to vote

just got a suggestion from the man the legend Michael Long himself. instead of resetting the singleton cache just store the current Firestore instance in a custom FirestoreManager() class. so the following rough code shows a much better, reactive approach:

class FirestoreManager {
  private(set) var currentFirestore: Firestore
  init(currentFirestore: Firestore = Firestore.firestore()) { self.currentFirestore = currentFirestore }
  func reinstantiateFirebase() async throws { ... }
  func signoutTerminateClearPersistence() async throws { ... }
}

extension Container {
   var firestoreManager: Factory<FirestoreManager> { self { FirestoreManager() }.singleton }
}

class myClass: ObservableOb…

Replies: 6 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dconeybe
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mikeymike9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants