-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Issue Description
Given:
- Subgraphs "A" and "B," where both define an entity
T, with a@keyofid - "A" defines field
T.a - "B" defines fields
T.bandT.c, whereT.c@requiresT.a
When executing a query that conditionally selects T.c, and unconditionally selects other, sibling fields on the entity (T) provided by the same subgraph ("B"), as in:
query q($v: Boolean!) {
t {
id
b
c @skip(if: $v)
}
}and v is the value true
Then:
T.b is never fetched, and is subsequently resolved to null, which can lead to inconsistent data responses.
Cause
The query plan executor receives a FetchNode with requirements (selection set) that include the field required by the excluded (via @skip) field, and the representation collection process (via executeSelectionSet()) attempts to extract that "required" field from the fetched entity data, in which it is (correctly) excluded. This results in null being returned for the fetch's selection set, and a "silent failure" in the case of null-able fields.
Link to Reproduction
https://codesandbox.io/p/devbox/fldc84
Reproduction Steps
- If not already running (should be in CodeSandbox), start all services with:
npm run dev- In a free terminal, send example request to reproduce the bug with:
npm run sendRequest