Replies: 2 comments
-
Hey @maccman ! That thing is done at https://github.com/quolpr/harika . It partially loads data from absurd-sql to mobx-keystone(on demand). And then all changes made at mobx-keyston are syncing back to absurd-sql(sqlite + indexeddb). It uses complex SQL queries a lot to seed required data to mobx-keystone. Works perfectly well on big DB. Such approach gives all the benefits from the in-memory and persistent DB worlds. Also, there is a sync mechanism. It saves the diff between new and old records, and sending it to server. Then server sending it back to all clients. The conflict resolution is done in time manner, the oldest change always wins. To avoid data loosing the time travel could be done(and I plan to implement it, not sure when) |
Beta Was this translation helpful? Give feedback.
-
Regarding riffle — it's funny, I was thinking to introduce similiar lib to react world, that gives ability to use sqlite with just a react hook |
Beta Was this translation helpful? Give feedback.
-
Has anyone done any work with integrating mobx-keystone and a client-side database such as IndexedDb or Sqlite?
Currently keystone is amazing for databases that fit in memory. But anything larger and things ground to a halt.
The solution is to have part of the db in memory, and part in disk. I'm thinking of a ORM layer over keystone that keeps all the mobx goodness. For example you could have live queries that automatically recompute if their contents change. And the same with records - their fields could be live too. To update the UI all you'd need to do is write to the database.
See some of the ideas here: https://riffle.systems/essays/prelude/
Beta Was this translation helpful? Give feedback.
All reactions