Replies: 2 comments 1 reply
-
Ooops I missed this. Let me take a look! |
Beta Was this translation helpful? Give feedback.
-
OK, so the main problem here is that you are trying to save a 'mergeable store' (which contains a bunch of CRDT metadata in it) into a plain set of tables in SQLite. Currently mergeable stores can only be saved into SQLite in 'JSON' mode, which provides TinyBase the mechanism to serialize that metadata. See the tables here for a sense of which persisters work for stores vs mergeable stores. Of course you could use a regular store with sqlite in tabular mode but you're going to have less determinism syncing data between disparate competing clients - that's the current trade-off. It's on the (long) list to support CRDT metadata alongside tabular data, but even that comes with a particular risk: folks might be tempted into thinking they can directly manipulate SQLite data - eg with SQL - not realizing they'd also have to update the slightly more cryptic metadata (in a neighboring table perhaps) to keep the CRDT's integrity. That's all I have for you for now, but hopefully that explains what's going on. And in the meantime I learned a bit about Svelte! I guess we should do bindings for that one day too... |
Beta Was this translation helpful? Give feedback.
-
I whipped up a small demo to see if I could get TinyBase to save to a sqlite database. It almost works, but not quite. It properly syncs whats in the table, but won't write to it, although I've had it nuke the data a few times. Not sure what I'm doing wrong. The test button on the page will add a new record, which works in the browser, but never makes it back to the sqlite database on the server. Refresh the page and the sync will delete that new record because its not on the server.
My test can be found at this link. Its just a sveltekit app with a node/express backend. I put console.log in all the error places, and I do see some errors, but I can't tell if they are real errors. There are better ways of doing this, but this is just a quick test. I'd like to eventually test out actual svelte functionality.
Any help would be greatly appreciated. Thanks
Beta Was this translation helpful? Give feedback.
All reactions