Fork me on GitHub
#pathom
<
2022-07-22
>
roklenarcic14:07:35

In pathom 3 resolvers’ resolve function is it possible to access properties from the config map of the resolver?

markaddleman14:07:57

This information is available from the environment https://pathom3.wsscode.com/docs/environment

roklenarcic14:07:30

I’ve looked at env pretty print and I don’t see any data about the resolver

roklenarcic14:07:45

and the ones described here don’t contain resolver either…

markaddleman14:07:13

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

markaddleman14:07:17

I don't recall the specifics, though

roklenarcic14:07:45

yes you can get inputs and outputs, but you cannot get say ::my-ns/prop that you put in resolver map

markaddleman14:07:12

Ah, my apologies. I misunderstood what you are trying to do

roklenarcic14:07:23

I did find a workaround though, so no worries

👍 1
roklenarcic16:07:01

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?

pithyless17:07:19

Unless I misunderstood, you need to get :a/a from (pco/params env) https://pathom3.wsscode.com/docs/resolvers#parameters

roklenarcic18:07:09

In my experience the params given to placeholder are given as inputs to resolver below

roklenarcic18:07:27

Also note the examples

wilkerlucio18:08:47

maybe a bug, can you send a full example @U66G3SGP5?

roklenarcic19:08:26

*edited the gist

wilkerlucio19:08:34

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

wilkerlucio19:08:51

so the context in which ::name and ::other appears are different

wilkerlucio19:08:07

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

wilkerlucio19:08:10

but you can use (p.ent/entity env) if you want to see the full available data

roklenarcic19:08:38

though I would expect (pco/? to cause it to supply the data

roklenarcic19:08:34

so if input is [::id (pco/? ::other)] and both are available I would expect that both are in nore-resolver-input

wilkerlucio19:08:35

humm, that optional case seems a bug

wilkerlucio19:08:42

it should be there if available

wilkerlucio19:08:19

but I like to give a heads about something that might change and break all this, that is related to data via placeholders

wilkerlucio19:08:42

I recently did some work that demonstrated to me that placeholder params as directly data might not be a good idea

wilkerlucio19:08:03

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

wilkerlucio19:08:11

so I'm considering breaking changes on this

wilkerlucio19:08:06

instead maybe use some specific parameters to flow data down (like: (:>/ph {:pathom/merge-data {::foo "bar"}}))

wilkerlucio19:08:35

this way Pathom allows for a better extension story on params