Skip to content
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

(core) - Deprecate the "operationName" property and move to "kind" #1045

Merged
merged 21 commits into from
Oct 28, 2020

Conversation

bkonkle
Copy link
Contributor

@bkonkle bkonkle commented Oct 6, 2020

Resolves #1005

Summary

It's currently tricky to differentiate between the urql-specific Operation.operationName property, and the more general OperationDefinitionNode.name.value property. This PR deprecates the "operationName" property in favor of "kind", issues a warning the first time the deprecated property is accessed, and updates all exchanges.

Set of changes

  • Added packages/core/src/utils/deprecation.ts - a utility for issuing deprecation warnings only once.
  • Added packages/core/src/utils/operation.ts with makeOperation - a utility for creating Operation objects with a getter/setter for the operationName property that issues a deprecation warning.
  • Updated packages/core/src/client.ts to use makeOperation and move property references from "operationName" to "kind".
  • Updated the core cache, dedup, fallback, fetch, ssr, and subscription exchanges to move references from "operationName" to "kind".
  • Updated references in the exchanges packages.

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2020

🦋 Changeset detected

Latest commit: 41bc6c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@urql/exchange-auth Patch
@urql/exchange-execute Patch
@urql/exchange-graphcache Patch
@urql/exchange-multipart-fetch Patch
@urql/exchange-persisted-fetch Patch
@urql/exchange-populate Patch
@urql/exchange-refocus Patch
@urql/exchange-retry Patch
@urql/exchange-suspense Patch
@urql/core Minor
urql Patch

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

packages/core/src/types.ts Outdated Show resolved Hide resolved
@bkonkle bkonkle marked this pull request as ready for review October 7, 2020 15:20
@bkonkle bkonkle requested a review from kitten October 7, 2020 15:26
Copy link
Collaborator

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work Brandon!

@kitten
Copy link
Member

kitten commented Oct 7, 2020

Let's figure out when we want to release this 🤔 I don't expect anyone to have any major issues with this change, since it won't be breaking unless someone does something absolutely weird, but it's worth double checking.

@kitten
Copy link
Member

kitten commented Oct 7, 2020

Update: I loaded the sandbox as a quick smoke test and it all seems to work fine but it is triggering the warning, which is odd. https://codesandbox.io/s/urql-issue-template-client-forked-nsrde

The addMetadata utility was definitely kept in the wrong
place since it concerns operations.
`makeOperation` has been updated to fill out the context
if it isn't passed which may become convenient in a couple
of places, instead setting it to the `operation.context`.
@kitten kitten changed the title Deprecate the "operationName" property and move to "kind" (core) - Deprecate the "operationName" property and move to "kind" Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Deprecate operationName in favour of kind
3 participants