-
Notifications
You must be signed in to change notification settings - Fork 104
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
(processVariables: true) do not collect input if variable is missing #456
(processVariables: true) do not collect input if variable is missing #456
Conversation
🦋 Changeset detectedLatest commit: abd8362 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 |
const info = collect( | ||
parse(/* GraphQL */ ` | ||
query getProjects($pagination: PaginationInput, $type: ProjectType!) { | ||
projects(filter: { pagination: $pagination, type: $type }) { | ||
id | ||
} | ||
} | ||
`), | ||
{ | ||
type: 'STITCHING', | ||
} | ||
).value; | ||
|
||
expect(info.fields).toContain(`FilterInput.type`); | ||
expect(info.fields).toContain(`FilterInput.pagination`); | ||
expect(info.fields).not.toContain(`PaginationInput.limit`); | ||
expect(info.fields).not.toContain(`PaginationInput.offset`); | ||
}); |
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.
hmmm, if it's not collecting PaginationInput
then when PaginationInput
is removed (because it's safe from the usage reports perspective) this query will fail, no? Because it contains PaginationInput
and it's not defined.
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.
oh, yes, you're right. I need to think about it and find a way to handle this case
@kamilkisiela , I just pushed new changes. I didn't test anything yet, but it looks to me like it SHOULD be ok this way both from UI and GraphQL Inspector perspectives. Just want to hear your opinion before going forward. |
@kamilkisiela I've tested it manually with a local instance of Hive and it looks good to me. Please check attached screenshots. In the UI I can see that
What do you think? Can we merge this PR? |
2425ec7
to
abd8362
Compare
Thank you very very very much |
I will deploy it to production tomorrow |
woohoo, thank you @kamilkisiela ! |
Fix for the case when an optional variable is not provided