Fork me on GitHub
#pathom
<
2019-09-21
>
cjsauer14:09:49

@wilkerlucio I’m interested in integrating pathom with datascript in a manner similar to what you’ve done with pathom-datomic. Given acceptable code, would you accept a PR for that, or do you think that should exist in its own pathom-datascript repo?

wilkerlucio16:09:54

@cjsauer that sounds cool! I think a separated repo is better in this case, even though they look similar, they are different things

cjsauer16:09:31

Yeah that seems reasonable. I have a prototype working right now, but it’s a bit rough. Still testing…

cjsauer21:09:39

So, it works, but it obviously requires that you specify everything in the schema. In datascript, it’s common to specify only :db/unique, :db.cardinality/many, and :db.type/ref attributes; everything else goes unspecified. This means that using the plugin requires “padding” the schema with the attributes you’re expecting to resolve, e.g.

(def schema {:todo/title {}})
Seems one way to automate this is to perform resolution (i.e. (ds/pull ...)) in the ::pc/compute-output handler in order to determine what exactly datascript already knows. Then “subtract” the parent query from that. This is my first look at pathom internals, but for some reason performing resolution in order to compute outputs feels…weird :thinking_face: