graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Patch responses containing results for Nested Defer statements do not contain the correct full path

Open cabillin opened this issue 1 year ago • 0 comments

Product

Hot Chocolate

Version

13.9.7

Link to minimal reproduction

https://github.com/cabillin/hot-chocolate-issues/tree/nested-defer

Steps to reproduce

Execute the query below

query bob {
  parents {
    id
    ... @defer(label: "children") {
        child {
            id
            ... @defer {
              lastComment {
                contents
              }
            }
        }
    }
  }
}

What is expected?

Client able to build a response equivalent to if there was no nested defer e.g.

query bob {
  parents {
    id
    ... @defer(label: "children") {
        child {
            id
              lastComment {
                contents
              }
        }
    }
  }
}

results in

{
  "data": {
    "parents": [
      {
        "id": 1,
        "child": {
          "id": "Child1",
          "lastComment": {
            "contents": "hello world"
          }
        }
      },
      {
        "id": 2,
        "child": {
          "id": "Child2",
          "lastComment": {
            "contents": "hello world"
          }
        }
      },
...
    ]
  }
}

What is actually happening?

Response

{
  "data": {
    "parents": [
      {
        "id": 1,
        "child": {
          "id": "Child1"
        }
      },
...
    ],
    "child": {
      "lastComment": {
        "contents": "hello world"
      }
    }
  }
}

Example Patch containing comment data

{
  "data": {
    "lastComment": {
      "contents": "hello world"
    }
  },
  "path": [
    "child"
  ],
  "hasNext": false
}

Notice that the path contains only "child" where as it should look something like [ "parents", 9, "child", 1 ]

Relevant log output

No response

Additional context

No response

cabillin avatar Aug 01 '24 23:08 cabillin