Hashnode / Hashnode/support

GraphQL Argument of `6` in `posts(first: 6)` causes no post edges to be returned

オープン
#82 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
48
フォーク
48
PR マージ指標
30日以内にマージされた PR はありません

説明

When running this query in the gql playground:

```gql
query GetSeriesList($host: String!, $first: Int!) {
publication(host: $host) {
seriesList(first: $first) {
edges {
node {
id
name
slug
description {
html
}
posts(first: 6) {
edges {
node {
id
title
brief
slug
publishedAt
coverImage {
url
}
author {
name
profilePicture
}
}
}
}
}
}
}
}
}

```

I get the following returned, even though there is one post in the single series in my hashnode blog:

```json
{
"data": {
"publication": {
"seriesList": {
"edges": [
{
"node": {
"id": "...",
"name": "...",
"slug": "...",
"description": {
"html": "..."
},
"posts": {
"edges": []
}
}
}
]
}
}
}
}
```

All I need to do is choose any integer that isn't `6` to get the API to return the expected post edges:

```gql
query GetSeriesList($host: String!, $first: Int!) {
publication(host: $host) {
seriesList(first: $first) {
edges {
node {
id
name
slug
description {
html
}
posts(first: 20) {
edges {
node {
id
title
brief
slug
publishedAt
coverImage {
url
}
author {
name
profilePicture
}
}
}
}
}
}
}
}
}

```

returns:

```json
{
"data": {
"publication": {
"seriesList": {
"edges": [
{
"node": {
"id": "...",
"name": "...",
"slug": "...",
"description": {
"html": "..."
},
"posts": {
"edges": [
{
"node": {
...
}
}
]
}
}
}
]
}
}
}
}
```
Hopefully this behavior is easy to map against the resolver logic.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

gql playground でネストされた seriesList/posts クエリを再現し、posts(first: 6) と表示されている他の整数値を比較します。その後、関連する resolver ロジックを追跡し、クエリが first: 6 に対しても期待される post edge を返すことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。