This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-28
Channels
- # announcements (14)
- # autochrome-github (1)
- # babashka (4)
- # beginners (151)
- # biff (1)
- # calva (24)
- # cider (13)
- # clara (13)
- # clj-commons (1)
- # cljs-dev (24)
- # clojure (50)
- # clojure-europe (20)
- # clojure-france (13)
- # clojure-nl (4)
- # clojure-norway (12)
- # clojure-spec (43)
- # clojure-uk (6)
- # clojurescript (30)
- # cursive (2)
- # datahike (9)
- # editors (6)
- # emacs (2)
- # fulcro (29)
- # google-cloud (20)
- # graphql (2)
- # humbleui (2)
- # jobs (2)
- # juxt (4)
- # kaocha (5)
- # lsp (14)
- # malli (5)
- # membrane (10)
- # off-topic (39)
- # pathom (21)
- # polylith (10)
- # rdf (8)
- # reagent (4)
- # remote-jobs (3)
- # reveal (18)
- # shadow-cljs (27)
- # spacemacs (7)
- # tools-deps (30)
I am using Pathon 2 still. I need to write a resolver that takes an ident and a parameter. Despite my efforts to figure this out, I am unable to get the parameter in my resolver. Can someone show me an example of this, or help e? Thanks in advance!
The Pathom docs give a pretty clear example I think: https://blog.wsscode.com/pathom/#_parameters
corresponding fulcro section: https://book.fulcrologic.com/#_parameters
Here is my code
(defresolver werkers-by-service-location-resolver
[env {:location/keys [position] :service/keys [id] :as input}]
{::pc/input #{:location/position}
::pc/params [:service/id]
::pc/output [{:werkers-by-service-location [:werker/id]}]}
(log/spy input)
(log/spy (-> env :ast :params))
{:werkers-by-service-location []})
And the parameter will not be coming in the input
argument (second one) of the resolver, it's in the env
.
so you query for [([:location/position "something"] {:service/id 123})]
but you do not see the 123 anywhere inside the env / ast?
[({[:location/zipcode "85286"] [:werkers-by-service-location]} {:service/id #uuid "ffffffff-ffff-ffff-ffff-000000000100"})]
I have a resolver from :location/zipcode
to :location/position
It is working properly.
Nope. That’s not it. Here’s the output: (-> env :ast) => {:type :prop, :dispatch-key :werkers-by-service-location, :key :werkers-by-service-location}
I can replicate it, Using my minimalist-fulcro-template-backendless' person resolver, the env
contains :ast {:type :prop, :dispatch-key :person/name, :key :person/name}
and the only place that seems to have the params is :com.wsscode.pathom.core/root-query
which is [({[:person/id 1] [:person/name]} {:service/id 123})]
Ok. Thanks @U0522TWDA!
I think I recall running into situations where a join param didn't work but placing the param on the ident did. Try that?
Fulcro only supports params at the top level. The query above was actually generated by (df/load!
I would ask @U066U8JQJ for help figuring out why the params are inside root-query
but not inside :ast
, as https://clojurians.slack.com/archives/C68M60S4F/p1646083719605539?thread_ts=1646081061.832729&cid=C68M60S4F. I think the fact that the ast being {:type :prop, :dispatch-key :person/name ...}
indicates that we are kind of "one level down" in the ast and we would need to get to the parent level, where :type join
to see the params. I am not sure how this is supposed to work.
Perhaps https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/pathom.clj#L110 is relevant here
The plugin works indeed - after adding it, the env has :query-params {:service/id 123}
I confirm that @U0522TWDA. Thanks again for your help!!!!!
My pleasure