I'm wanting to use datascript as my global app state, but I'm not quite sure how to get components to update when the database updates. I could just make them rum/react
on the datascript conn atom, but then everything updates whenever anything happens.
Any ideas on how I could only make relevant components update? (Possibly by having to specify what components are going to need to update when doing a transaction)
I suppose a 're-run all queries' strategy could work for simple stuff.
Take a look at Posh library https://github.com/mpdairy/posh
AFAIK: it tries to be a bit more efficient by inferring changes from transaction log provided by DataScript
@roman01la Yeah, I've looked at posh. From what I could tell the idea didn't feel very clean, though perhaps I should take another look. Is it not tighly coupled to reagent?
@ghopper Haven’t tried it, so don’t really know about Reagent.
As for change inference, yes, some say it’s kinda working most of the times
Alright, perhaps I should consider just using a global atom with a map for my database.
@roman01la Does it makes sense to use a atom with a map and a lot of nested cursors for the state?
yes, that’s totally fine
I suppose I should try to keep it normalized somehow? Perhaps using om.next's database format.
yes, ideally state should be normalized, you can do this by hand if you want (not familiar with om.next’s format)
but basically this way you are modeling a DB 🙂
just without query language
Sounds good. Thanks 🙂