Commit 5b3f2d92 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Merge branch 'bw-graphql-cyclic-issue-connection' into 'master'

Fix unresolved name due to cyclic definition

See merge request gitlab-org/gitlab!84202
parents 7568227e b2c60b1a
......@@ -135,6 +135,7 @@ Naming/FileName:
- 'qa/qa/specs/**/*'
- 'qa/tasks/**/*.rake'
- '**/*.ru'
- 'app/graphql/types/issue_connection.rb'
IgnoreExecutableScripts: true
AllowedAcronyms:
......
......@@ -12,7 +12,8 @@ module Resolvers
required: false,
description: 'Current state of this issue.'
type Types::IssueType.connection_type, null: true
# see app/graphql/types/issue_connection.rb
type 'Types::IssueConnection', null: true
NON_STABLE_CURSOR_SORTS = %i[priority_asc priority_desc
popularity_asc popularity_desc
......
# frozen_string_literal: true
# Normally this wouldn't be needed and we could use
# type Types::IssueType.connection_type, null: true
# in a resolver. However we can end up with cyclic definitions,
# which can result in errors like
# NameError: uninitialized constant Resolvers::GroupIssuesResolver
#
# Now we would use
# type "Types::IssueConnection", null: true
# which gives a delayed resolution, and the proper connection type.
# See app/graphql/resolvers/base_issues_resolver.rb
# Reference: https://github.com/rmosolgo/graphql-ruby/issues/3974#issuecomment-1084444214
Types::IssueConnection = Types::IssueType.connection_type
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment