This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-22
Channels
- # announcements (7)
- # babashka (17)
- # beginners (45)
- # biff (2)
- # cider (16)
- # clj-on-windows (3)
- # cljs-dev (12)
- # clojure (27)
- # clojure-austin (1)
- # clojure-europe (18)
- # clojure-norway (5)
- # clojurescript (36)
- # conjure (35)
- # core-async (2)
- # datascript (4)
- # datomic (4)
- # emacs (15)
- # fulcro (23)
- # holy-lambda (12)
- # hyperfiddle (1)
- # introduce-yourself (5)
- # nbb (11)
- # off-topic (37)
- # pathom (34)
- # pedestal (9)
- # reitit (4)
- # releases (1)
- # remote-jobs (1)
- # sci (5)
- # scittle (3)
- # shadow-cljs (88)
- # tools-build (4)
In pathom 3 resolvers’ resolve function is it possible to access properties from the config map of the resolver?
This information is available from the environment https://pathom3.wsscode.com/docs/environment
I’ve looked at env pretty print and I don’t see any data about the resolver
and the ones described here don’t contain resolver either…
Yes, the information about the resolver is not in the docs but I think I've looked up resolver inputs and outputs through the environment
I don't recall the specifics, though
yes you can get inputs and outputs, but you cannot get say ::my-ns/prop
that you put in resolver map
Ah, my apologies. I misunderstood what you are trying to do
@U66G3SGP5 Have you tried pci/resolver-config
? https://cljdoc.org/d/com.wsscode/pathom3/2022.07.08-alpha/api/com.wsscode.pathom3.connect.indexes#resolver-config
Hm I am writing a dynamic resolver and I noticed that if I wrap it into a placeholder, the node-resolver-input
of the dynamic resolver doesn’t get that. So {(:>/placeholder {:a/a 1}) [:dyn/attr]}
doesn’t get :a/a 1 in input as expected… or am I reading this wrong?
Unless I misunderstood, you need to get :a/a
from (pco/params env)
https://pathom3.wsscode.com/docs/resolvers#parameters
In my experience the params given to placeholder are given as inputs to resolver below
Also note the examples
maybe a bug, can you send a full example @U66G3SGP5?
*edited the gist
on the first invoke, the behavior is correct, because you have an ident inside the placeholder, the ident makes a new entity and doesn't pull anything from the parent entity
so the context in which ::name
and ::other
appears are different
the second is also what is expected, because you never get things on your resolver that you dont ask on the input, this is by design to prevent implicit dependencies
but you can use (p.ent/entity env)
if you want to see the full available data
though I would expect (pco/?
to cause it to supply the data
so if input is [::id (pco/? ::other)]
and both are available I would expect that both are in nore-resolver-input
humm, that optional case seems a bug
it should be there if available
but I like to give a heads about something that might change and break all this, that is related to data via placeholders
I recently did some work that demonstrated to me that placeholder params as directly data might not be a good idea
because I see a case where I needed some specific placeholder params, that are not related to input data, and the current behavior kind forces it to happen
so I'm considering breaking changes on this
instead maybe use some specific parameters to flow data down (like: (:>/ph {:pathom/merge-data {::foo "bar"}})
)
this way Pathom allows for a better extension story on params