Commit 780639a6 authored by James Lopez's avatar James Lopez

Merge branch...

Merge branch '216851-graphql-externallypaginatedarrayconnection-can-return-incorrect-number-of-items' into 'master'

GraphQL: ExternallyPaginatedArrayConnection can return incorrect number of items

Closes #216851

See merge request gitlab-org/gitlab!31252
parents 1088e398 2bbeabc2
---
title: Fix incorrect number of errors returned when querying sentry errors
merge_request: 31252
author:
type: fixed
......@@ -23,6 +23,20 @@ module Gitlab
alias_method :has_next_page, :next_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
......
......@@ -19,6 +19,20 @@ describe Gitlab::Graphql::Pagination::ExternallyPaginatedArrayConnection do
it_behaves_like 'connection with paged nodes' do
let(:paged_nodes_size) { values.size }
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
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