5 ms·
Having recently built an offline first app (mobile app I'll admit), we didn't use a command queue, and I regret it deeply now. I advise everyone who's reading t
by yonkshi 10y ago
Having recently built an offline first app (mobile app I'll admit), we didn't use a command queue, and I regret it deeply now. I advise everyone who's reading this to go for a command queue. Saves a lot of time debugging data sync.
Our biggest challenge was to sync data with relationships, especially data with circular relationships. We couldn't come up with a generic way to sync circular relationships, so we ended up building a very special purpose buffer on both client and server side.
- CorvusCrypto 10y agois there anything more you can say about your buffer solution? Curious if it is something similar to vector clock syncing that you guys came up with.
- Pxtl 10y agoWhat was the challenge with circular relationships? I work on an offline-first system and all inter-object relationships are managed by GUIDs, so cyclical references don't present any problems - objects are sent and received as one big list keyed by guids, not as a tree.
- allannienhuis 10y ago"objects are sent and received as one big list keyed by guids, not as a tree" That's an interesting pattern I've not heard of before - any links you could recommend for more details on it? It sounds really useful for moderate sized data sets.
- kemayo 10y agoI remember coming across it fairly heavily in react/redux stuff, mostly because it makes dealing with redux's stores a lot simpler if you avoid nested structures like that. There's a library called normalizr[1], whose purpose is to take nested API responses and turn them into flat structures. Have an article[2] about it. [1]: https://github.com/paularmstrong/normalizr https://github.com/paularmstrong/normalizr [2]: https://tonyhb.gitbooks.io/redux-without-profanity/content/normalizer.html https://tonyhb.gitbooks.io/redux-without-profanity/content/n...
- CorvusCrypto 10y agodidn't Netflix do a bunch of research into json-graph? They seemed to have figured this problem out.
- jinjin2 10y agoDid you consider using an off-the-shelf solution like Realm? In my experience it made it trivial to handle the synchronization of arbitrarily complex object graphs (including those with circular dependencies).