How to synchronize local and cloud storage data

Hi Everyone,

Been tinkering with AppGyver for a while now and have figured how to do a whole bunch of things using the docs and some forum posts but I’m stuck trying to figure out the best way to synchronize local storage data with AppGyver cloud storage data.

For the data structure. I have 2 main objects. Object1 & Object2. Object1 contains an array of Object2 and Object2 has a string property which is an id of an Object1.
Object2 is what needs to be saveable offline and then synchronized when there’s internet connectivity. I have explored having a data resource for cloudstorage which has an id and then an array of jsons but then I am unable to have control over the id field so that I can fetch that singular cloud data resource to push the array of Object1 (containing Object2 data within) that has been saved in local storage.

I have yet to explore the possibility of using an external database and pushing the local data out via the Rest API but I would like to believe both options are possible.

cc @Harri_Sarsa and @SeanHoots (Fellow Bubble user here.)

It would be helpful to have some real-world names for the resources and sample mock data, hard to wrap my mind around the data model here. :slight_smile:

In general, you’d want to save your pending operations in a SyncQueue or similar client-side resource, and then write code that fetches all unsynced records from SyncQueue and sends them to the backend. Since there’s no batch create, you need to create a looping logic that then calls Create record for each object in the client-side resource. Or, if the sync queue data can be saved as a JSON into a single object, you can just do a single create/update.

Thanks for your response @Harri_Sarsa. Nothing especially complex about the data atm. Just 2 objects linked both ways with one (parent) containing arrays of the other and the other (child) containing an id of its parent.

So from your answer it seems like AppGyver has no native support for seamlessly syncing this data without using code and/or slightly altering the way it is stored.

I will explore using a single cloud object to save the local data further and let you know how that goes.

1 Like

Yeah, no “native” support for that yet unfortunately. You can always post a feature request to tracker.appgyver.com with info on how you’d like it to work.

Hey @Yinka

Did you get any further with this concept?