Replying to Avatar hzrd149

nostr:npub1jlrs53pkdfjnts29kveljul2sm0actt6n8dxrrzqcersttvcuv3qdjynqn nostr:npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft and any other client devs

Id like to get your thoughts on this (very MVP) library I'm building for #noStrudel https://github.com/hzrd149/applesauce/tree/master/packages/core

The idea is to run an in-memory database and have the UI ( react, svelte, etc... ) talk to it with "queries"

Then the data loading layer of the app (outbox model, dumb relay list, etc...) would feed events into this database as needed and the UI would update

This would effectively separate the UI layer from the more complicated relay fetching logic.

My motivation for building this is my data loaders in noStrudel commonly get stuck (as most complex logic does) and because they don'tt talk to each other a user might see an event in the notifications but then the thread loader couldn't find it

I'm aware it may have some performance impacts vs rendering the events straight to the DOM. But the fact that you could have all the events needed for the UI in a single place seems like it would be worth it

Judging just from the readme, this is exactly how @welshman/app works. I found indexeddb way too slow to use interactively, so I hydrate once at page load and batch writes to it. I then use "repository" to store all my events, and "relay" to wrap in a "executor target" (see @welshman/net) so that I can use it like a normal relay. I then have some utilities in @welshman/store that wrap the repository in svelte stores so that I can reactively update my app. It works really well.

Reply to this note

Please Login to reply.

Discussion

Oh cool, so I'm on the right track

Although my goal with this library is to be more modular and less of a framework

Because there are tons of times I need random helper methods for parsing events and I don't need a full framework

Welshman is decently composable, hence the separate libraries. Utils/net might save you some coding

I'll look into it. Although like any rouge developer I prefer to reinvent the wheel 😀

I know right? Same here 😂

Hmmm, I've been using indexeddb via Dexie.js.

All of my relay handling routines store events into Dexie and then my UI is generated off from Svelte/Dexie LiveQueries from DB changes.

This conceptually keeps relays separate from ui, and works well for PWAs. Probably not the fastest though.

I used liveQuery for a while, and maybe I was holding it wrong but it seemed slow and sort of unreliable. Which client are you building? I could have something to do with data model, or just how much data is getting pulled in

Some personal clients I haven't put out into the public yet. They are light duty, so it could be a setup that doesn't scale well, but for now it seems to be working fine.