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

fix: display correct name for operations with fragments #411

Conversation

mellisdesigns
Copy link
Contributor

@mellisdesigns mellisdesigns commented Nov 11, 2021

Summary
Currently when fetching the operation we take the first operation found. This can include fragments defined at the top of the query string which ends up with the wrong operation name and query

Approach
Find the first OperationDefinition and return that (this filters out fragment types but keeps mutations and queries which are still validated as a single definition in one operation string)

Example of the fragment returned instead of the query

image
image

@mellisdesigns
Copy link
Contributor Author

#409

Copy link
Collaborator

@spawnia spawnia left a comment

Choose a reason for hiding this comment

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

One simplification is possible, but otherwise it looks good

tests/operation.test.ts Outdated Show resolved Hide resolved
Co-authored-by: Benedikt Franke <benedikt@franke.tech>
Copy link
Collaborator

@spawnia spawnia left a comment

Choose a reason for hiding this comment

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

Good change

@mellisdesigns
Copy link
Contributor Author

bump?

@spawnia spawnia changed the title bug - query strings that include fragments return undefined in the name fix: display correct name for operations with fragments Dec 16, 2021
@spawnia spawnia merged commit 6b759b9 into DiederikvandenB:master Dec 16, 2021
@mellisdesigns mellisdesigns deleted the bug/support-query-strings-which-include-fragments branch December 16, 2021 20:22
github-actions bot pushed a commit that referenced this pull request Feb 27, 2022
## [3.0.3](v3.0.2...v3.0.3) (2022-02-27)

### Bug Fixes

* display correct name for operations with fragments ([#411](#411)) ([6b759b9](6b759b9))
* include errors in breadcrumbs starting with the first ([0d272ce](0d272ce))
* include partial GraphQL errors in breadcrumbs ([#410](#410)) ([a3d929d](a3d929d))

### Performance Improvements

* avoid repeated property accesses in SentryLink.ts ([#422](#422)) ([b32e4f5](b32e4f5))
@github-actions
Copy link

🎉 This PR is included in version 3.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants