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 edge case for empty operations #959

Merged
merged 2 commits into from
Feb 2, 2019

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Feb 1, 2019

Filter out 'undefined' definitions before checking the length

It's possible to leave a whole query behind when removing fields by directive. In that case, we want to exclude it altogether. In the current state, definitions can === [undefined], giving a length of 1 and passing this check. By filtering for truthy values only, we won't include empty operations in the result of this function.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

It's possible to leave a whole query behind when filtering by directive. In that case, we want to exclude it altogether.
In the current state, definitions can === [undefined], giving a length of 1 and passing this check. By filtering for
truthy values only, we won't include empty operations in the result of this function.
@trevor-scheer trevor-scheer changed the title Fix codegen edge case for an empty operation Fix edge case for empty operations Feb 2, 2019
@trevor-scheer trevor-scheer merged commit 4681538 into master Feb 2, 2019
@trevor-scheer trevor-scheer deleted the trevor/fix-empty-definitions branch February 2, 2019 00:14
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.

1 participant