Fork me on GitHub

What am I missing here regarding parameters for pathom3?

(def eql-with-params
  ['({[:asset/id 13] [:asset.series/level]}
     {:time.series/from #inst "2021-12-11T00:00:00.000-00:00",
      :time.series/to #inst "2021-12-16T00:00:00.000-00:00"})])

(pco/defresolver series-resolver [env _]
  {:asset.series/level {:params-expected-but-is-empty (pco/params env)}})

(def env (pci/register series-resolver))

(p.eql/process env eql-with-params)

=> {[:asset/id 13] {:asset.series/level {:params-expected-but-is-empty {}}}}


hello, the problem is the position of the params, in this example the params is set at the ident level, and params don't flow down (they are only acessible at the place they were defined)


this is the query to send the params at the right place in your case:

(def eql-with-params
  ['{[:asset/id 13]
        {:time.series/from #inst "2021-12-11T00:00:00.000-00:00",
         :time.series/to   #inst "2021-12-16T00:00:00.000-00:00"})]}])


this issue is about a conceptually mismatch in this case, for Fulcro it thinks the params are "entity level", but for Pathom the params are "per attribute", the common solution in Fulcro with Pathom 2 is to use Pathom plugin that forwards down the params from a parent entity via environment


another thing I believe (have to test) you can do is to put the param strait in the query, instead of using the fulcro :params thing


the plugin solution doesn't exist afaik for Pathom 3 yet


In Pathom3, I use the three arity p.eql/process to keep the query separate from the entity. My "params" are folded into the entity map. I haven't encountered any problems taking this approach but I'm wondering if there is any advantage to keeping "params" separate from the entity