-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Improve operation
type for SetContextLink
#12742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: b787b47 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
size-limit report 📦
|
@@ -17,5 +17,5 @@ export function transformOperation(operation: GraphQLRequest): GraphQLRequest { | |||
: ""; | |||
} | |||
|
|||
return transformedOperation as Operation; | |||
return transformedOperation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semi-related - this seems to strip out operationType
, which we actually want to preserve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #12748
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good catch on that. I removed the type cast since the function had an explicit return and now I'm glad I made some noise in this file 😆
This is something I noticed when converting a different app. The
operation
argument given to the callback inSetContextLink
was aGraphQLRequest
type which included thecontext
property. This property was alwaysundefined
so using it could result in bugs when really you should be using theprevContext
argument instead.This PR adjusts the type to ensure
context
is not part of the type. This PR also adds theclient
property from theoperation
so that its accessible like other links.