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) - Make DocumentNode serialization idempotent #1509

Merged
merged 3 commits into from
Apr 3, 2021

Conversation

zenflow
Copy link
Contributor

@zenflow zenflow commented Apr 3, 2021

Summary

Fixes #1508

Set of changes

This makes DocumentNode serialization idempotent.
In other words, this makes it so we get the same serial representation (and therefore hash key) for a DocumentNode each time it is computed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 3, 2021

🦋 Changeset detected

Latest commit: d8c59a9

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) - Make DocumentNode serialization idempotent, closes #1508 (core) - Make DocumentNode serialization idempotent Apr 3, 2021
Copy link
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

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

This is a really awesome catch! I didn't realise that this would introduce an inconsistency in GraphQL Code Generator output since I didn't consider that loc mane left out at times depending on its mode, which is entirely probable in other use cases too. Also nice idea to fix it this way 🔥

The only thing that's left is that some snapshots need updating now, however a yarn test -u run should fix that. The changeset also has a suggestion by me to make it a little more descriptive

.changeset/fair-beds-happen.md Outdated Show resolved Hide resolved
@zenflow
Copy link
Contributor Author

zenflow commented Apr 3, 2021

@kitten Suggestion for changeset applied and Jest snapshots updated :)

Copy link
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

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

Cheers! I'll have to check next week whether any of the hash changes will adversely affect anything else, but it seems perfectly fine to me ✌️

@kitten kitten merged commit 6e6ac18 into urql-graphql:main Apr 3, 2021
@github-actions github-actions bot mentioned this pull request Apr 3, 2021
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.

Under certain conditions a different key is generated for the same DocumentNode
2 participants