Closed henryqdineen closed 6 months ago
Name | Link |
---|---|
Latest commit | d2c81dc281ecbec65201f951ab4fde2ede7b47d1 |
Latest deploy log | https://app.netlify.com/sites/apollo-client-docs/deploys/66294b43876f0b0009bc2bb9 |
Deploy Preview | https://deploy-preview-11756--apollo-client-docs.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Latest commit: d2c81dc281ecbec65201f951ab4fde2ede7b47d1
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](https://github.com/henryqdineen/apollo-client/new/hqd-fix-set-context-type?filename=.changeset/fast-points-sip.md&value=---%0A%22%40apollo%2Fclient%22%3A%20patch%0A---%0A%0AFix%20operation.setContext()%20type%0A)
While we're at it, could you please also add these adjustments?
--- a/src/link/utils/createOperation.ts
+++ b/src/link/utils/createOperation.ts
@@ -5,14 +5,14 @@ export function createOperation(
operation: GraphQLRequest
): Operation {
let context = { ...starting };
- const setContext = (next: any) => {
+ const setContext: Operation["setContext"] = (next) => {
if (typeof next === "function") {
context = { ...context, ...next(context) };
} else {
context = { ...context, ...next };
}
};
- const getContext = () => ({ ...context });
+ const getContext: Operation["getContext"] = () => ({ ...context });
Object.defineProperty(operation, "setContext", {
enumerable: false,
Just made the adjustments. Thanks! No rush.
I noticed couple issues with the
Operation.setContext()
types that I try to fix in this PR:void
and does not returnDefaultContext