rynobax / hathi

Backend for Tembo
2 stars 0 forks source link

Syncing between devices #4

Open rynobax opened 5 years ago

rynobax commented 5 years ago

I feel like this is something we need to figure out pretty early on. I'm thinking the data will basically be of two types

I'm thinking that for schema data we can queue up events (add run, delete cook, change read to week). Then when you get a connection they can all be sent to the server, and afterwards the new master schema can be downloaded (in case they made changes on another device)

For daily summary, it could be a similar process. If there are any conflicts, we just go with the last one.

We could also poll every x minutes when the app is open for updates.

Also instead of querying the server in components, we should probably just query a local cache (something like redux), and whenever we query the server we just update the cache. That way for the case of a guest account (where they aren't registered) we don't have to do anything fancy, we just never query the server.

Does that make sense? Any cases I'm not thinking of? Any data that we will want to store that I didn't mention?