Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/graphql/pagination/relation_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,19 @@ def limited_nodes
# Load nodes after applying first/last/before/after,
# returns an array of nodes
def load_nodes
# Return an array so we can consistently use `.index(node)` on it
@nodes ||= limited_nodes.to_a
return @nodes if @nodes

if @loading_nodes
context.dataloader.yield until @nodes
return @nodes
end

@loading_nodes = true
begin
@nodes = limited_nodes.to_a
ensure
@loading_nodes = false
end
end
end
end
Expand Down
Loading