Commit b2c60b1a authored by Brett Walker's avatar Brett Walker

Fix unresolved name due to cyclic definition

This problem is seen with 1.13.11 of the graphql gem
parent 29c6a47c
......@@ -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