-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: offline-first (or tutorial) #255
Comments
Native offline-first functionality is definitely something we're thinking about for the future! That being said, the underlying Userbase data structure is quite powerful, and what you're trying to do with Automerge should be possible to do in a decently performant way! A deeper explanation of how Userbase works under the hood, and why I believe it can be relied on to work with operation-based CRDTs: when a client calls any of the database write operations ( What the above all means is that you can rely on Writing
Reading
Note that all the changes would need to fit in to the client's memory for this to work, but I believe if you're working with Automerge, you make that assumption anyway since each item holds all historical state. All the building blocks are there! |
I made an offline-first Google Docs alternative to show how to do this! It's a bit complex - planning to provide a simple tutorial on how to create a super basic version of that^ here. In the meantime, here are the relevant areas of the code:
|
@j-berman epic! hey if you want somebody to proofread your tutorial i'm happy to help out - bion at bitpharma dot com |
Dear Team Userbase,
Thank you for making this platform!
One thing I hacked, and got stuck in the weeds with, was offline-first. I did manage to hack it, but it's not exactly an ideal solution -- we store the app state in a single entry in userbase, then use ramda.mergeDeepRight to merge the one with the later timestamp into the one with the older timestamp. It feels like a hack, and this could lose data, because it's Last Write Wins instead of some other option. Also, I doubt it's highly performant or scalable to stuff the whole user data blob into a single key.
Would it be possible for userbase to add some offline-first function, or perhaps a tutorial to figure that out? It would be incredibly cool to have a sort of CRDT / ORDT so userbase apps would 'just work' offline, and sync automatically. I dabbled with automerge but it didn't work with ramda.
What do you think?
Thanks in advance for continued development of userbase!
Bion
The text was updated successfully, but these errors were encountered: