You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: pass abortSignal to resolvers via GraphQLResolveInfo (#4425)
In #4261 (not yet released in v17) we made abortSignal available to resolvers via a fifth argument to the field resolver. Among other things, this means that any code that processes schemas to wrap resolvers in other functions would have to be aware of this one new feature and specially thread through the new behavior. It also changed the TypeScript signature of GraphQLFieldResolver to *require* passing the fifth argument (even if undefined).
But the field resolver interface already has a place for GraphQL-JS to put a grab-bag of helpful named objects for use by resolvers: `GraphQLResolveInfo`.
This PR (which is not backwards compatible with v17.0.0-alpha.8, but is backwards-compatible with v16) moves the abortSignal into `GraphQLResolveInfo`.
It also improves the test of this feature to actually make use of the AbortSignal API (the previous test actually passes when this change is made, without changing the test to find the AbortSignal in the new
location).
Copy file name to clipboardExpand all lines: website/pages/upgrade-guides/v16-v17.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,7 @@ Use the `validateInputValue` helper to retrieve the actual errors.
178
178
179
179
- Added `hideSuggestions` option to `execute`/`validate`/`subscribe`/... to hide schema-suggestions in error messages
180
180
- Added `abortSignal` option to `graphql()`, `execute()`, and `subscribe()` allows cancellation of these methods;
181
-
the `abortSignal` can also be passed to field resolvers to cancel asynchronous work that they initiate.
181
+
`info.abortSignal` can also be used in field resolvers to cancel asynchronous work that they initiate.
182
182
-`extensions` support `symbol` keys, in addition to the normal string keys.
183
183
- Added ability for resolver functions to return async iterables.
184
184
- Added `perEventExecutor` execution option to allows specifying a custom executor for subscription source stream events, which can be useful for preparing a per event execution context argument.
0 commit comments