Fork me on GitHub
#graphql
<
2020-02-05
>
miguelb20:02:14

Has anyone used async resolvers with with-context?

miguelb20:02:41

For example in https://lacinia.readthedocs.io/en/latest/resolve/context.html , if resolve-products was an async field resolver, how would send down the search-term to the highlighted-name resolver?

hlship21:02:29

Async isn't fully async; you can't resolve nested fields until resolve what they are nested under.

hlship21:02:53

So you would create a resolve-promise and return that.

hlship21:02:47

When you deliver! the promise, you can deliver a value wrapped with a context.

hlship21:02:51

And it all works.

hlship21:02:46

The nested field resolvers will see the customized context.