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

has_previous_page and has_next_page always False while navigating

未关闭
#12 4 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
144
派生
41
PR 合并指标
30 天内没有已合并 PR

描述

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`.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 graphql_relay/connection/arrayconnection.py 的第 104-105 行附近开始,使用 first 搭配 after 以及 last 搭配 before 重现报告中的查询。跟踪游标边界如何用于设置 pageInfo,然后为这两种情况添加回归测试。当 hasPreviousPage 和 hasNextPage 报告可用的相邻页面,而不是始终为 false 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。