Fork me on GitHub
#pathom
<
2024-03-28
>
countgizmo13:03:06

Hello everyone! Is there a way to pass params to a nested resolver?

wilkerlucio16:03:49

hello, can you give an example of what you are looking for?

countgizmo07:04:06

Sure! I have a resolver that returns :acme/companies That resolver's input is :acme/company-reponses though, which is an output of another resolver that actually does the network request (I followed one of the tutorials on Pathom's website). The "client" calls Pathom to get :acme/companies but there's a bit of information that the "client" has that the network request needs. Let's call it extra-fields. So if the client passed extra-fields as a parameter, only the top level resolver - the one that returns :acme/companies will get it. But it would be cool if I can pass it to the :acme/company-responses resolver. The :acme/company-responses resolver is batch, so I could pass the extra-fields as part of every input item but that's not idea because the extra-fields are shared for all the inputs so I'll be repeating the same extra-fields which is error-prone and kinda looks not optimal.

countgizmo07:04:45

As a workaround I've combined the two resolvers for now 😞 Which is a petty because I liked to have networking resolver separate - makes it easier to test the non-networking resolver separately.