Fork me on GitHub
Garrett Hopper14:11:05

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)

Garrett Hopper14:11:58

I suppose a 're-run all queries' strategy could work for simple stuff.

Roman Liutikov15:11:00

AFAIK: it tries to be a bit more efficient by inferring changes from transaction log provided by DataScript

Garrett Hopper15:11:42

@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?

Roman Liutikov15:11:25

@ghopper Haven’t tried it, so don’t really know about Reagent.

Roman Liutikov15:11:50

As for change inference, yes, some say it’s kinda working most of the times

Garrett Hopper15:11:02

Alright, perhaps I should consider just using a global atom with a map for my database.

Garrett Hopper15:11:04

@roman01la Does it makes sense to use a atom with a map and a lot of nested cursors for the state?

Roman Liutikov15:11:07

yes, that’s totally fine

Garrett Hopper15:11:49

I suppose I should try to keep it normalized somehow? Perhaps using's database format.

Roman Liutikov15:11:41

yes, ideally state should be normalized, you can do this by hand if you want (not familiar with’s format)

Roman Liutikov15:11:59

but basically this way you are modeling a DB 🙂

Roman Liutikov15:11:09

just without query language

Garrett Hopper15:11:01

Sounds good. Thanks 🙂