Updating a signal vs Updating the data in the database

I have a model created by various signals that is local to the browser. I also use indexedDB solid-dexie to persist some data. Now when I make changes to my model I want parts of changes to be persisted to the database as well. I said I am using solid-dexie, but what are some libraries or best practices to handle persistence of the application? My use case is local only preferrably IndexedDB on the browser as the main database.
7 Replies
Madaxen86
Madaxen864d ago
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
Madaxen86
Madaxen864d ago
It has a storage adapter localforage to store the signal/store in the indexedDB.
gsoutz
gsoutzOP4d ago
and what about performance of the sql capabilities of this library you mentioned, I can't query with sql so is it terrible for large data?
Madaxen86
Madaxen864d ago
This is just a wrapper to persist a store or signal and which also loads everything back to the store when initialised. I have never used it with indexedDB. So I can’t really speak about performance and using sql queries.
gsoutz
gsoutzOP4d ago
Yes, but what I am really asking is, when I am using dexie with sql queries, or a server database with server data sync. How do I syncronize my model with the server database or my local IndexedDB. Do I use a command pattern where every action fires a command that both updates the server and the local data at the same time. Or is there a more blacker magic can do this sort of pattern actions. I would like to also support an Undo functionality as well, how would that change things.
Madaxen86
Madaxen864d ago
If you use solid router Then createAsync and get functions with query to get data and actions to mutate data is what I would use. Actions invalidate queries when successful. Now syncing local and server databases is a whole different story. Especially how to resolve conflicts etc There’s a syntax episode about local first. They also recommend some libraries that implement strategies to sync local and server dbs. https://syntax.fm/show/793/the-local-first-landscape
The Local First Landscape - Syntax #793
Discussion of various tools and libraries for building local first web applications
gsoutz
gsoutzOP4d ago
Thanks for the resource i will listen that.

Did you find this page helpful?