graphql

miguelb 2020-02-05T20:19:14.025400Z

Has anyone used async resolvers with with-context?

miguelb 2020-02-05T20:21:41.027700Z

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?

hlship 2020-02-05T21:46:29.028200Z

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

hlship 2020-02-05T21:46:53.028600Z

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

hlship 2020-02-05T21:47:47.029100Z

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

hlship 2020-02-05T21:47:51.029300Z

And it all works.

hlship 2020-02-05T21:48:46.030100Z

The nested field resolvers will see the customized context.