Skip to content

Fix edge case for empty operations#959

Merged
trevor-scheer merged 2 commits intomasterfrom
trevor/fix-empty-definitions
Feb 2, 2019
Merged

Fix edge case for empty operations#959
trevor-scheer merged 2 commits intomasterfrom
trevor/fix-empty-definitions

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

@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