re-frame

migalmoreno 2024-12-09T16:20:41.980099Z

Is there an equivalent of https://github.com/akiroz/re-frame-storage for IndexedDB? LocalStorage's 5MB quota has fallen short for my project :(

p-himik 2024-12-09T16:23:34.349519Z

No library that I'm aware of, but even just whether you can use it via interop or not depends on the exact use case.

migalmoreno 2024-12-09T17:05:59.574119Z

It's just for basic client-side persistence that exceeds the local storage quota, basically to have a replica of re-frame-storage for reading/writing from indexeddb. Seems like someone already created a nice cljs wrapper for it https://github.com/brianium/indexed.db, so IIUC to keep everything re-frame idiomatic we would first need to adapt storage-atom to support indexeddb's state and then create a wrapper re-frame effect/cofx which reads and writes to it, like what's mentioned in this thread https://clojureverse.org/t/re-frame-and-indexeddb/7360 ?

p-himik 2024-12-09T17:08:49.134759Z

If the only instance where you read the data is at the app's start, then yeah, kinda. You don't need an atom for any intermediate storage, so no need to bring storage-atom into this. Just read the data at the app's start and write it whenever you want to persist it (maybe with a global interceptor), that's it. But if you need to read from it during the app's run time, you'll have to use polling because IndexedDB does not have any notification mechanism.

migalmoreno 2024-12-09T17:30:14.555969Z

Yeah, I only need the data at startup to populate re-frame's db and then the occasional write. Will give the global interceptor a try, thank you

2024-12-10T05:01:10.456669Z

@c7607e73-ff69-4682-b0 the todomvc example does this for local store.so that might provide a map of the territory