Skip to content

Commit

Permalink
changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
EmrysMyrddin committed Feb 6, 2025
1 parent 01a6195 commit cdeb918
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .changeset/curvy-months-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'graphql-yoga': minor
---

## New hook `onOperation`

This new hook is called for each GraphQL operaiton to handle. It allows to replace the
default Yoga operation handler.

Example: Wrap the GraphQL handling pipeline in an `AsyncLocalStorage`

```ts
function myPlugin(): Plugin {
const context = new AsyncLocalStorage();
return {
onOperation({ operationHandler, setOperationHandler }) {
const store = { foo: 'bar' }
setOperationHandler((payload) => context.run(store, operationHandler, payload))
}
}
```

0 comments on commit cdeb918

Please sign in to comment.