Fork me on GitHub
#graphql
<
2017-11-03
>
stijn15:11:31

in lacinia, is there a way to pass on the (possibly updated context) between mutations that are being resolved in sequence (e.g. the updated database value from the previous mutation)? like resolve/with-context but then between top-level resolvers

hlship18:11:45

I'm afraid not. It would take add some significant complexity to support that, and I'm not sure it's a good idea.

hlship18:11:15

That is, if it could be done, it would create a special case that would likely be abused in some way, causing further headaches.

hlship18:11:45

I'm afraid you'll probably need to stuff an atom into the context before execution, to communicate information from the first mutation to the later ones.

stijn08:11:33

Ok, makes sense. In this case I can use the DB connection instead of the calculated db at the beginning of the request.

stijn08:11:23

For queries it is important that 1 request shows a consistent view of the database, but for mutations that is already not the case since they execute transactions and return query results after the transaction