Offline mode woes

35 views
Skip to first unread message

bbous...@gmail.com

unread,
Sep 14, 2016, 11:46:51 AM9/14/16
to Firebase Google Group
Greetings,

I've been trying to add offline mode support to our app using the latest Firebase SDK on iOS. I've been experiencing weird issues, however.

Simplified database structure:

projects
(key)
key1: value1
key2
subkey1: value1
subkey2: value2 
key3
(subkey)
subsubkey1: value1 
 
 
 

When the app launches, I set the keepSynced flag to true on all relevant projects for the current user (i.e. on all projects/(key) nodes that belong to said user). This works fine and I can keep accessing the data if the connection drops.

If I create a new project while offline, however, I experience peculiar issues:

Example project:

projects
(key generated with childByAutoId)
key1: value1
key2
subkey1: value1
subkey2: value2 
key3
(subkey)
subsubkey1: value1 
 
I assume the write goes through to the local cache (since we get no callback until it gets written to the real database) but trying to call single value observers is unreliable: I can retrieve key2 and its contents without a hitch but key1 and key3 get stuck (as if the data wasn't available - i.e. the callback is not called until I reestablish the network connection). I'm trying to find a pattern to all of this but I'm afraid there is something I just don't understand.

Any ideas?

Regards,

-BB

bbous...@gmail.com

unread,
Sep 14, 2016, 1:11:15 PM9/14/16
to Firebase Google Group
key1 is fine, actually. The nodes I cannot read are "projects/(key)" and "projects/(key)/key3".

Strangely, even though I can't read the nodes above, I can read "projects/(key)/key1" and "projects/(key)/key3/(subkey)" without any issues.

I'm puzzled.

bbous...@gmail.com

unread,
Sep 15, 2016, 6:25:50 PM9/15/16
to Firebase Google Group
Cross posted to StackOverflow:


I was using deep links in updateChildValues and those seem to cause issues with the local cache states. Expanding those links so the dictionary is more verbose seems to do the trick. I don't believe this is expected behaviour, however.
Reply all
Reply to author
Forward
0 new messages