Skip to content

Commit 293ca15

Browse files
authored
Merge pull request #5355 from rmosolgo/master-fix-loads-regression
Use a faster check for loadable?
2 parents 7bbcf60 + 94c6284 commit 293ca15

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/graphql/schema/visibility/profile.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ def directives
256256
end
257257

258258
def loadable?(t, _ctx)
259-
load_all_types
260-
!@all_types[t.graphql_name] && @cached_visible[t]
259+
@cached_visible[t] && !referenced?(t)
261260
end
262261

263262
def loadable_possible_types(t, _ctx)

lib/graphql/schema/warden.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ def types
232232

233233
# @return [Boolean] True if this type is used for `loads:` but not in the schema otherwise and not _explicitly_ hidden.
234234
def loadable?(type, _ctx)
235-
!reachable_type_set.include?(type) && visible_type?(type)
235+
visible_type?(type) &&
236+
!referenced?(type) &&
237+
(type.respond_to?(:interfaces) ? interfaces(type).all? { |i| loadable?(i, _ctx) } : true)
236238
end
237239

238240
def loadable_possible_types(union_type, _ctx)

0 commit comments

Comments
 (0)