GenerateIDFieldTransform is not automatically adding ID fields
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Based on https://github.com/facebook/relay/blob/1b43a4671d07ae69b3cbe36f1c21c2978f6419f2/packages/relay-compiler/transforms/GenerateIDFieldTransform.js, it seems like `GenerateIDFieldTransform` should automatically query for `id` fields when available.
This is also mentioned here: https://stackoverflow.com/questions/64524994/do-i-need-to-always-pull-the-id-field-when-using-react-relay
However, for this query:
```
const query = graphql`
query AccountSetupModalContainerUserQuery($id: String!) {
User_by_pk(id: $id) {
__typename
}
}
`;
```
Relay generates the following:
```
"text": "query AccountSetupModalContainerUserQuery(\n $id: String!\n) {\n User_by_pk(id: $id) {\n __typename\n }\n}\n"
```
It does *not* query for the `id` field, even though it is present on our `User` type (the abbreviated type is below)
```
type User {
id: String!
}
```
And here's the type of `User_by_pk`
```
User_by_pk(id: String!): User
```
Contributor guide
Assessment
This issue has not been assessed yet.