firebase / firebase/firebase-ios-sdk

FR: call completion block in setData when offline

Open
#3,303 2 comments 0 reactions 0 assignees View on GitHub
api: firestore type: feature request
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 14h
Merged PRs (30d)
72

Description

OSX 10.14.5
Xcode version: 10.2.1

Using FirebaseAuth (6.1.2)
Using FirebaseAuthInterop (1.0.0)
Using FirebaseCore (6.0.3)
Using FirebaseFirestore (1.4.0)
Using FirebaseUI (6.2.1)

I think what I am seeing is the the documented and intended behaviour but it causes a problem in some circumstances.

I would like to be able to create a new document, when both online and offline, and then query for it shortly after. The current behaviour of setData doesn't allow this in Firestore iOS.

When offline the completion callback does not happen, this means I cannot use the callback version of setData to manage program flow in my code. However if I don't wait for the callback while online I sometimes get "Missing or insufficient permissions" errors when querying a document too soon after creating it.

So neither way to call setData is usable both online and offline if you want to query the data soon after creation.

Would it be possible for the completion block to still fire when offline once the document has been written locally and is indexed/queryable? I understand this might be confused as confirmation of a successful write to the db, but this would still be better than no callback. Maybe use an error containing a warning that the write is not confirmed?

Thanks

P

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.