This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-12
Channels
- # announcements (19)
- # babashka (33)
- # beginners (96)
- # bitcoin (6)
- # cider (11)
- # circleci (5)
- # clj-kondo (22)
- # cljs-dev (4)
- # cljsjs (2)
- # clojure (65)
- # clojure-australia (9)
- # clojure-berlin (1)
- # clojure-europe (53)
- # clojure-italy (2)
- # clojure-nl (2)
- # clojure-uk (42)
- # clojurescript (9)
- # conjure (1)
- # cursive (33)
- # data-oriented-programming (1)
- # data-science (6)
- # datomic (12)
- # emacs (12)
- # fulcro (7)
- # graphql (4)
- # honeysql (5)
- # jobs (2)
- # juxt (8)
- # lsp (30)
- # malli (9)
- # off-topic (9)
- # other-languages (1)
- # re-frame (17)
- # reagent (11)
- # reitit (5)
- # releases (2)
- # remote-jobs (3)
- # shadow-cljs (39)
- # spacemacs (6)
- # sql (2)
- # testing (3)
- # tools-deps (43)
- # vim (5)
- # xtdb (11)
When using datomic/datascript with fulcro+pathom, how do you ellide over the :db/ids in relationships?
For example :person/pet
is a :db.cardinality/one :db.type/ref, and a pet has a :pet/id
uuid which is of course distinct from the pet entity's :db/id
. But the pull query in the person-resolver
returns {... :person/pet 2 ... }
where 2 is the db/id of the pet. But the pet-resolver
expects :pet/id
.
Do you post-process the response from the pull query to replace 2
with an ident [:pet/id uuid]
?
Pondering this more, I think the way to do it is to not have the person-resolver
merely return :person/pet
in its bag of attributes but something like {:person/pet [:pet/id]}
So person-resolver
would use a pull query like [:person/id :person/name {:person/pet [:pet/id]}]
.
hmm and I can put the pull query in a (def person-query [...])
then reuse it in the (d/pull db person-query ..)
) as well as the pathom resolver declaration ::pc/output person-query
!
Wait until you hear about dynamic resolvers in pathom. :-D
Another beginner question: When writing an Electron app, I guess you would model the Electron IPC — so the communication between main and renderer process — with pathom as well? At least that’s how I would understand the first section of chapter 10 in the book. And I will have a local-only database in my app (Datascript, it will basically be a music collection pointing to local music files), so I’m wondering if — details aside — it makes sense to have two remotes (for now), one being the Electron main process, the other my background database…?
yes, that's a nice architecture to put it
Thanks, it certainly helps from time to time to get some external validation when you’re starting out with Fulcro! It feels like I understand more every day now, finally. 🙂