Fork me on GitHub
#pathom
<
2021-11-04
>
fabrao11:11:34

Hello, how do you use clojure testing with resolvers if I want to use interactive testing like in Calva? I tried changing the resolver, evaluated again and it seems keeping the old version

wilkerlucio12:11:02

you have to remember to also reload the file that builds up the env, so you can rebuild your indexes with the new resolver configuration

fabrao13:11:58

I think the problem is that the resolvers are in def , so I have to reload the namespace and the namespace that call that name space, I did it and it worked, thank you

robert-stuttaford15:11:17

we can use the #'my-resolver trick when building the index right @U066U8JQJ?

wilkerlucio15:11:09

that is not enough, the problem is that what matters for pathom is the indexes, which get created on the pci/register call, this is why this needs to be re-evaluated when resolver changes to compute the new indexes

wilkerlucio15:11:52

there are possible tricks around, like keeping the indexes in an atom and derrefing at run time (using plugins), this approach has an issue with removing things, another approach would be to keep the resolvers in some mutable atom, and on each call re-compute all of it (something you surely don't wanna do in prod, but is useful in dev time)

jmayaalv16:11:41

what we do is to create pathom-env as fn, and during testing/dev we create always a new one on each call. ex:

(defn query! [context tx]
  (interface/query! (p.eql/boundary-interface   (interface/pathom-env context)) txl))

👍 2
jmayaalv16:11:29

similar for dev, we have an interceptor that creates the pathom boudnary-interface for each request

jmayaalv12:11:29

still the downside is that pathom-viz connector doesn’t see the changes, so when needed we connect to connector via http that triggers the reload interceptor.

cyppan19:11:26

I’m wondering what is the expected behavior of having nested and optional input in a resolver input at the same time (ex: ::pco/input (pco/? {:nested [:id :name]}))? I’ve tried and I don’t get the result I would expect.

wilkerlucio02:11:52

that optional is misplaced, it should be [{(pco/? :nested) [:id :name]}]

cyppan08:11:10

oh yes I messed up my repro case sorry I’ve updated the gist, I still have the problem https://gist.github.com/cyppan/bbdfdb16d267051ad1e675c4a38ced5f

👀 1