File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,16 @@ def cursor_from_node(item)
25
25
26
26
def has_next_page
27
27
if first
28
- paged_nodes . length >= first && sliced_nodes_count > first
29
- elsif GraphQL ::Relay ::ConnectionType . bidirectional_pagination && last
30
- sliced_nodes_count >= last
31
- else
32
- false
28
+ if defined? ( ActiveRecord ::Relation ) && nodes . is_a? ( ActiveRecord ::Relation )
29
+ initial_offset = after ? offset_from_cursor ( after ) : 0
30
+ return paged_nodes . length >= first && nodes . offset ( first + initial_offset ) . exists?
31
+ end
32
+ return paged_nodes . length >= first && sliced_nodes_count > first
33
+ end
34
+ if GraphQL ::Relay ::ConnectionType . bidirectional_pagination && last
35
+ return sliced_nodes_count >= last
33
36
end
37
+ false
34
38
end
35
39
36
40
def has_previous_page
You can’t perform that action at this time.
0 commit comments