graphql-python / graphql-python/graphql-relay-py

has_previous_page and has_next_page always False while navigating

Đang mở
#12 4 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
144
Fork
41
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

While using the pageInfo `hasPreviousPage` and `hasNextPage` cursor based navigation (before and after), it seems these results are always set to False.

The corresponding code (https://github.com/graphql-python/graphql-relay-py/blob/master/graphql_relay/connection/arrayconnection.py#L104-L105):
```python
return connection_type(
edges=edges,
page_info=pageinfo_type(
start_cursor=first_edge_cursor,
end_cursor=last_edge_cursor,
has_previous_page=isinstance(last, int) and start_offset > lower_bound,
has_next_page=isinstance(first, int) and end_offset < upper_bound
)
)
```

Querying with `first: 5, after: "xxx"` in this case always results in `hasPreviousPage: false`.
The same for `last: 5, before: "xxx"`, which results always in `hasNextPage: false`.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start in graphql_relay/connection/arrayconnection.py around lines 104-105 and reproduce the reported queries using first with after and last with before. Trace how the cursor bounds are used to set pageInfo, then add regression coverage for both cases. Done means hasPreviousPage and hasNextPage report the available adjacent pages instead of always being false.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.