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) - Add fragment deduping to gql tag #1225

Merged
merged 10 commits into from
Dec 11, 2020
Merged

Conversation

kitten
Copy link
Member

@kitten kitten commented Dec 11, 2020

Summary

This change implements a missing feature of the gql tag. While it previously warned about fragments with duplicate names, it didn't check whether these fragments were identical and deduplicated them. This change implements fragment deduplication and solidifies some of our DocumentNode#__key and ASTNode#loc additions.

Set of changes

  • Incrementally add an operation's definitions to a new gql document
  • Add ASTNode.loc in stringifyDocument
  • Switch gql to apply this behaviour to raw DocumentNode inputs only

@changeset-bot
Copy link

changeset-bot bot commented Dec 11, 2020

🦋 Changeset detected

Latest commit: a1bfa80

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

This PR includes changesets to release 1 package
Name Type
@urql/core 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

@kitten kitten changed the title (core) - Add fragment dedupe to core's gql tag (core) - Add fragment deduping to gql tag Dec 11, 2020
packages/core/src/gql.ts Outdated Show resolved Hide resolved
packages/core/src/gql.ts Outdated Show resolved Hide resolved
packages/core/src/gql.ts Outdated Show resolved Hide resolved
@kitten kitten merged commit 41db82e into main Dec 11, 2020
@kitten kitten deleted the feat/dedupe-fragments-gql branch December 11, 2020 15:26
@github-actions github-actions bot mentioned this pull request Dec 11, 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.

None yet

2 participants