We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b768d4 commit ef34b49Copy full SHA for ef34b49
lib/graphql/relay/relation_connection.rb
@@ -23,9 +23,21 @@ def cursor_from_node(item)
23
end
24
25
26
+ def record_exists?(record)
27
+ if(defined?(ActiveRecord::Relation) && record.is_a?(ActiveRecord::Relation))
28
+ record.exists?
29
+ else
30
+ !record.empty?
31
+ end
32
33
+
34
def has_next_page
35
if first
- paged_nodes.length >= first && nodes.offset(first).exists?
36
+ if after
37
+ paged_nodes.length >= first && record_exists?(nodes.offset(first + offset_from_cursor(after)))
38
39
+ paged_nodes.length >= first && record_exists?(nodes.offset(first))
40
41
elsif GraphQL::Relay::ConnectionType.bidirectional_pagination && last
42
sliced_nodes_count >= last
43
else
0 commit comments