Reputation: 11577
I'm using Firebase/Firestore 7.14.4 for data storage in a single page web app. On Chrome, Firefox, and others, the app performs just fine. In Safari, however, on both Mac and iOS, the first call after login to DocumentReference.get()
takes minutes and minutes, or indeed never completes. This occurs:
The code that produces this problem could not be simpler.
firebase.auth().onAuthStateChanged( async (user) => {
if( user ) {
const userDoc = db.collection( 'users' ).doc( user.uid );
const docSnapshot = await userDoc.get(); // <- .get() never returns
// ...
}
}
Again, this happens only on Mac and iOS Safari, not in Chrome or Firefox.
Anyone else seen anything like this?
Upvotes: 0
Views: 527
Reputation: 599716
I just ran this trivial example in both Chrome and Safari:
var start = Date.now();
firebase.auth().signInAnonymously();
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
firebase.firestore().doc("61881285/me").get().then(function(doc) {
console.log(`Signed in and got doc in ${Date.now()-start}ms`);
console.log(doc.id, '=>', doc.data());
});
}
});
The results:
Let me know if you get different results when you run the jsbin.
If you are getting different results with your code but not the above, I'd love to see a similar example that we can run to reproduce those results.
Upvotes: 2