This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-16
Channels
- # announcements (19)
- # babashka (41)
- # beginners (9)
- # calva (1)
- # cider (28)
- # clerk (2)
- # clj-kondo (33)
- # cljs-dev (1)
- # clojars (32)
- # clojure (29)
- # clojure-europe (36)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-uk (4)
- # clojurescript (33)
- # datahike (6)
- # datomic (44)
- # emacs (35)
- # fulcro (25)
- # hyperfiddle (22)
- # introduce-yourself (1)
- # java (11)
- # kaocha (7)
- # membrane (3)
- # off-topic (2)
- # pathom (7)
- # polylith (15)
- # portal (3)
- # squint (1)
Hey everyone!
Is it possible to pass params
from one resolver to another?
Or maybe I'm thinking about params
all wrong.
The issue is that params
are going to the top-most resolver, but it also has an input from another resolver and I would like the params
to be passed to that resolver as well without mentioning it in the query.
hello, can you tell more about your use case?
I'll try... I have a resolver that returns a bunch of companies using their links. But the resolver depends on an input from another resolver - the one that actually does the web call to get the data. Looks something like this:
(pco/defresolver get-company
[{:keys [link]}]
{::pco/input [:company-response]
::pco/output [:company]}
{:company (parse-response company-response))})
When I pass params to the query like this
[{:companies
['(:company {:someparam 42})]}]
I can get that param in get-company
resolver but I don't see the param in the resolver that's providing the :company-response
input.Now that I'm looking at it again. Maybe the resolver that provides the network response can just be a function that I call from the get-company
resolver. Then I can propagate the params as args in a function call.
Maybe I'm just overcomplicating things 🙂
The param in this case controls which query to add in the request and which function to use to parse the response. In the example I've posted the parsing is easy to determine, cause I have the param in the "top level" resolver. But I need a way to pass this information to the resolver that does the request.
Actually, after experimenting with the code some more I've realized that I need two different resolvers because I will need to have two different outputs at the top level, like :company
and :that-other-info
So it's not a param situation it's just two different resolvers situation.