GatsbyJS + Drupal 8 + GraphQL-关系查询返回重复的结果

时间:2018-10-11 13:05:38

标签: reactjs graphql drupal-8 graphql-js gatsby

我正在将GatsbyJS与gatsby-source-drupal插件一起使用。这是我的graphQL查询:

  query {
        allUserUser(filter: {name : {eq: "bobdole"}}) {
        totalCount
        edges {
          node {
                name
            relationships {
            node__personal_information {
            field_first_name
            field_surname
            field_email
            field_phone
            field_date_of_birth
            }
            }

          }
        }
    }
    }

正如您在此处看到的那样,即使totalCount返回1,关系的结果也会重复。

{
  "data": {
    "allUserUser": {
      "totalCount": 1,
      "edges": [
        {
          "node": {
            "name": "bobdole",
            "relationships": {
              "node__personal_information": [
                {
                  "field_first_name": "Bob",
                  "field_surname": "Dole",
                  "field_email": "bobdole@gmail.com",
                  "field_phone": "07795063053",
                  "field_date_of_birth": "1991-08-30"
                },
                {
                  "field_first_name": "Bob",
                  "field_surname": "Dole",
                  "field_email": "bobdole@gmail.com",
                  "field_phone": "07795063053",
                  "field_date_of_birth": "1991-08-30"
                }
              ]
            }
          }
        }
      ]
    }
  }
}

这是查询问题还是我的Drupal 8设置问题。

谢谢!

0 个答案:

没有答案