Commit 2bbeabc2 authored by Brett Walker's avatar Brett Walker

Return all nodes since pagination is external

Regression introduced when moved to newer
GraphQL pagination classes
parent f17db538
---
title: Fix incorrect number of errors returned when querying sentry errors
merge_request: 31252
author:
type: fixed
...@@ -23,6 +23,20 @@ module Gitlab ...@@ -23,6 +23,20 @@ module Gitlab
alias_method :has_next_page, :next_page? alias_method :has_next_page, :next_page?
alias_method :has_previous_page, :previous_page? alias_method :has_previous_page, :previous_page?
private
def load_nodes
@nodes ||= begin
# As the pagination happens externally we just grab all the nodes
limited_nodes = items
limited_nodes = limited_nodes.first(first) if first
limited_nodes = limited_nodes.last(last) if last
limited_nodes
end
end
end end
end end
end end
......
...@@ -19,6 +19,20 @@ describe Gitlab::Graphql::Pagination::ExternallyPaginatedArrayConnection do ...@@ -19,6 +19,20 @@ describe Gitlab::Graphql::Pagination::ExternallyPaginatedArrayConnection do
it_behaves_like 'connection with paged nodes' do it_behaves_like 'connection with paged nodes' do
let(:paged_nodes_size) { values.size } let(:paged_nodes_size) { values.size }
end end
context 'when after or before is specified, they are ignored' do
# after and before are not used to filter the array, as they
# were already used to directly fetch the external array
it_behaves_like 'connection with paged nodes' do
let(:arguments) { { after: next_cursor } }
let(:paged_nodes_size) { values.size }
end
it_behaves_like 'connection with paged nodes' do
let(:arguments) { { before: prev_cursor } }
let(:paged_nodes_size) { values.size }
end
end
end end
describe '#start_cursor' do describe '#start_cursor' do
......
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