Fork me on GitHub
#datascript
<
2020-10-10
>
teodorlu22:10:46

Is it a bad idea to store a whole Datascript db value inside a reagent.core/atom?

Oliver George23:10:38

I do. Works fine for me.

πŸ‘ 3
zane00:10:30

Yeah, can’t imagine why it would be.

πŸ‘ 3
teodorlu00:10:55

It still seems a bit ... wild ... to toss a database around in memory. Thanks for the sanity check :thumbsup:

πŸ‘ 6
clojure-spin 3
metasoarous18:10:39

@U3X7174KS It is wild πŸ™‚ But, datascript is just... an in memory database. So it's wild by design.

😁 3
metasoarous18:10:17

FWIW, this is more or less what Posh does.

teodorlu20:10:53

Ah, OK. I almost asked about what Posh actually does. After not too much code, I had something that worked decently, so I wondered if there was much more to it. Is it worth the extra dependency? I guess they may have thought a bit more about API design than what I collected.

Oliver George22:10:16

I’m in the same boat. I decided that I would work directly with the datascript until there was compelling reason to add a new dependency

πŸ‘ 3
metasoarous19:10:28

Yeah; So the thing Posh does is give you reactive queries that only update if it looks new transactions have a chance of effecting the result. So it saves you some compute. However, it doesn't always do this perfectly; There are some edge cases like recursive query rules (and maybe using query functions?), and I don't remember now whether it catches these and updates them automatically. As a last resort, you can specify a custom pattern for deciding when to rerun a query if something is amiss. I'd say it's pretty convenient and worth taking a look at.

πŸ‘ 3
metasoarous19:10:01

If don't expect to ever have too much data or too many queries though, it may not be necessary.

πŸ‘ 3