Fork me on GitHub
#fulcro
<
2021-03-12
>
Casey09:03:23

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

Casey09:03:11

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]}] .

Casey09:03:02

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 !

🤯 3
Björn Ebbinghaus12:03:40

Wait until you hear about dynamic resolvers in pathom. :-D

lokirrationalis14:03:02

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

wilkerlucio16:03:48

yes, that's a nice architecture to put it

lokirrationalis17:03:30

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. 🙂

🙂 7