-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add deprecations and warnings to ApolloClient
options and methods
#12736
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: c1929fd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 📦
|
@@ -815,27 +917,38 @@ export class ApolloClient<TCacheShape> implements DataProxy { | |||
|
|||
/** | |||
* Add additional local resolvers. | |||
* | |||
* @deprecated `addResolvers` will be removed in Apollo Client 4.0. Please use | |||
* `client.localState.addResolvers(resolvers)` instead. | |||
*/ | |||
public addResolvers(resolvers: Resolvers | Resolvers[]) { |
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.
Do we also want runtime warnings when using these functions or just leave it as an @deprecated
tag?
src/core/ApolloClient.ts
Outdated
* @deprecated `resolvers` has been changed in Apollo Client 4.0 and will no | ||
* longer be provided as an option directly to `ApolloClient`. `resolvers` | ||
* should continue to be used until upgrading to 4.0. |
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.
Suggestions welcome on wording here. I don't know how best to communicate "this will change, but only works as resolvers
until 4.0"
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.
* @deprecated `resolvers` has been changed in Apollo Client 4.0 and will no | |
* longer be provided as an option directly to `ApolloClient`. `resolvers` | |
* should continue to be used until upgrading to 4.0. | |
* @deprecated in preparation to the Apollo Client 4.0: | |
* `resolvers` will change in Apollo Client 4.0 and will no longer be provided as an option directly to `ApolloClient`. | |
* It is safe to keep using this option with Apollo Client 3.x. |
Maybe something like this?
❌ Docs preview failedThe preview failed to build. Build ID: 9cfb15a263f39791129092a0 ErrorsGeneral: other side closed |
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.
I'm missing a bit of a common structure for all of these deprecation comments.
Maybe we should have a common "template" for all of these comments?
Something like this:
* @deprecated in preparation of a migation to Apollo Client 4.0. It is safe to keep using this in Apollo Client 3.x.
| Description | This option will be renamed in Apollo Client 4.0. |
| ------------- | ------------- |
| On Migration | pass `prioritizeCacheValues` instead of `disableNetworkFetches` to the `ApolloClient` constructor |
| Recommended now | no action needed |
*/
Note that it's very difficult to get VSCode to display any structured data - there's no "nested list" support, so a table seems like the best option.
src/core/ApolloClient.ts
Outdated
* @deprecated `resolvers` has been changed in Apollo Client 4.0 and will no | ||
* longer be provided as an option directly to `ApolloClient`. `resolvers` | ||
* should continue to be used until upgrading to 4.0. |
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.
* @deprecated `resolvers` has been changed in Apollo Client 4.0 and will no | |
* longer be provided as an option directly to `ApolloClient`. `resolvers` | |
* should continue to be used until upgrading to 4.0. | |
* @deprecated in preparation to the Apollo Client 4.0: | |
* `resolvers` will change in Apollo Client 4.0 and will no longer be provided as an option directly to `ApolloClient`. | |
* It is safe to keep using this option with Apollo Client 3.x. |
Maybe something like this?
@phryneas take a look at the latest and see if you like that format. |
name: clientAwarenessName, | ||
version: clientAwarenessVersion, | ||
devtools, | ||
dataMasking, | ||
} = options; | ||
|
||
if (__DEV__) { |
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.
I avoided a warning for resolvers
and fragmentMatcher
in here since there is nothing actionable that can be done until the upgrade to 4.0. Having a warning that you can't get rid of I think would be too annoying.
Adds
@deprecated
tags to options and methods on theApolloClient
constructor that are no longer supported. Adds runtime warnings for other change.