This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-08
Channels
- # aleph (2)
- # announcements (2)
- # asami (50)
- # babashka (39)
- # beginners (17)
- # calva (61)
- # cider (9)
- # clj-kondo (5)
- # clojure (37)
- # clojure-europe (52)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (5)
- # clojurescript (28)
- # cursive (3)
- # datahike (11)
- # datomic (28)
- # deps-new (11)
- # events (3)
- # fulcro (18)
- # google-cloud (1)
- # graphql (8)
- # introduce-yourself (4)
- # jobs (2)
- # leiningen (7)
- # lsp (15)
- # pathom (9)
- # re-frame (6)
- # reagent (35)
- # reitit (17)
- # releases (1)
- # shadow-cljs (20)
- # specter (1)
- # test-check (106)
- # tools-deps (8)
- # uncomplicate (1)
- # vim (29)
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 {}}}}
I also explored down this path, with no clarity yet: https://clojurians.slack.com/archives/C68M60S4F/p1646737904726649?thread_ts=1646732244.136159&cid=C68M60S4F
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]
[(: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"})]}])
Ah. Fulcro generates it like I have it: https://clojurians.slack.com/archives/C68M60S4F/p1646732244136159?thread_ts=1646732244.136159&cid=C68M60S4F Is there something obvious I'm missing?
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