This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-18
Channels
- # adventofcode (18)
- # announcements (1)
- # asami (99)
- # babashka (4)
- # beginners (45)
- # calva (20)
- # cider (44)
- # cljdoc (5)
- # clojure (66)
- # clojure-australia (2)
- # clojure-europe (36)
- # clojure-nl (11)
- # clojure-norway (4)
- # clojure-seattle (1)
- # clojure-uk (88)
- # clojurescript (37)
- # community-development (8)
- # conjure (8)
- # datascript (4)
- # datomic (29)
- # depstar (12)
- # emacs (7)
- # events (1)
- # fulcro (29)
- # graalvm (4)
- # graphql (2)
- # helix (2)
- # integrant (4)
- # jobs (7)
- # jobs-discuss (1)
- # lsp (3)
- # malli (6)
- # off-topic (61)
- # pathom (67)
- # pedestal (3)
- # re-frame (9)
- # reitit (4)
- # remote-jobs (13)
- # reveal (18)
- # shadow-cljs (59)
- # spacemacs (1)
- # sql (7)
- # startup-in-a-month (1)
- # tools-deps (29)
- # vim (12)
Hey all,
Just wanted to share something I’ve been working on recently that essentially lets you use datascript’s d/entity
API (well, something similar) in reagent components, only triggering re-renders when the attributes you accessed on each entity change.
https://github.com/austinbirch/reactive-entity
It’s pretty early on implementation-wise, but I figured that maybe some people here would have experience using reagent and datascript together, so this might be worth sharing now anyway.
I apologise in advance for the readme, I just blurted it out in one sitting so it’s a bit stream of consciousness at the moment.
I assume this is going to be a bit more efficient than just putting the Datascript DB in a reagent atom?
Sorry @U3X7174KS, I’ve only just seen this.
Yeah, that’s it. If you put the DataScript DB in a reagent atom then all components that deref that atom will re-render on any DB change.
For many apps this works, but for apps that have a lot of UI components, or components that are expensive to render, then it becomes less than ideal.
There are other libraries that help solve this same problem, the most well-known is posh (https://github.com/mpdairy/posh). I’ve used posh a lot and it’s great. This library essentially does the same sort of thing that posh does for d/q
& d/pull
, but for d/entity
.