We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the pagination is :forward the offset is changed, but when the pagination is :backward the offset remains the same of the request. Ex:
:forward
:backward
iex(2)> Connection.offset(%{first: 2, after: Connection.offset_to_cursor(2)}) 3 iex(3)> forward_args = %{first: 2, after: Connection.offset_to_cursor(2)} %{after: "YXJyYXljb25uZWN0aW9uOjI=", first: 2} iex(4)> Connection.offset(forward_args) 3 iex(5)> Connection.limit(forward_args) {:ok, :forward, 2} iex(6)> backward_args = %{last: 2, before: Connection.offset_to_cursor(2)} %{before: "YXJyYXljb25uZWN0aW9uOjI=", last: 2} iex(7)> Connection.offset(backward_args) 2 iex(8)> Connection.limit(backward_args) {:ok, :backward, 2}
iex(2)> Connection.offset(%{first: 2, after: Connection.offset_to_cursor(2)}) 3 iex(3)> forward_args = %{first: 2, after: Connection.offset_to_cursor(2)} %{after: "YXJyYXljb25uZWN0aW9uOjI=", first: 2} iex(4)> Connection.offset(forward_args) 3 iex(5)> Connection.limit(forward_args) {:ok, :forward, 2} iex(6)> backward_args = %{last: 2, before: Connection.offset_to_cursor(2)} %{before: "YXJyYXljb25uZWN0aW9uOjI=", last: 2} iex(7)> Connection.offset(backward_args) 0 iex(8)> Connection.limit(backward_args) {:ok, :backward, 2}
Internally the calculation actually happens at https://github.com/absinthe-graphql/absinthe_relay/blob/master/lib/absinthe/relay/connection.ex#L279, but it seems to me that the method is behaving differently depending on the direction and would be easier if it returns the proper offset for the query.
The documentation on the method also explains that this is the expected behavior, I can submit a PR if that makes sense
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Current behavior
When the pagination is
:forward
the offset is changed, but when the pagination is:backward
the offset remains the same of the request. Ex:Expected behavior
Internally the calculation actually happens at https://github.com/absinthe-graphql/absinthe_relay/blob/master/lib/absinthe/relay/connection.ex#L279, but it seems to me that the method is behaving differently depending on the direction and would be easier if it returns the proper offset for the query.
The documentation on the method also explains that this is the expected behavior, I can submit a PR if that makes sense
The text was updated successfully, but these errors were encountered: