diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/support/graphql/field_selection.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/support/graphql/field_selection.rb')
-rw-r--r-- | spec/support/graphql/field_selection.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/spec/support/graphql/field_selection.rb b/spec/support/graphql/field_selection.rb index 00323c46d69..432340cfdb5 100644 --- a/spec/support/graphql/field_selection.rb +++ b/spec/support/graphql/field_selection.rb @@ -46,7 +46,7 @@ module Graphql NO_SKIP = ->(_name, _field) { false } - def self.select_fields(type, skip = NO_SKIP, parent_types = Set.new, max_depth = 3) + def self.select_fields(type, skip = NO_SKIP, max_depth = 3) return new if max_depth <= 0 || !type.kind.fields? new(type.fields.flat_map do |name, field| @@ -55,12 +55,8 @@ module Graphql inspected = ::Graphql::FieldInspection.new(field) singular_field_type = inspected.type - # If field type is the same as parent type, then we're hitting into - # mutual dependency. Break it from infinite recursion - next [] if parent_types.include?(singular_field_type) - if inspected.nested_fields? - subselection = select_fields(singular_field_type, skip, parent_types | [type], max_depth - 1) + subselection = select_fields(singular_field_type, skip, max_depth - 1) next [] if subselection.empty? [[name, subselection.to_h]] |