Commit d057bc1f authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'ntepluhina-add-id-requirement-to-graphql-docs' into 'master'

Add ID requirement to GraphQL docs

See merge request gitlab-org/gitlab!75729
parents a3d95d99 b2f24d25
...@@ -171,6 +171,40 @@ import { getIdFromGraphQLId } from '~/graphql_shared/utils'; ...@@ -171,6 +171,40 @@ import { getIdFromGraphQLId } from '~/graphql_shared/utils';
const primaryKeyId = getIdFromGraphQLId(data.id); const primaryKeyId = getIdFromGraphQLId(data.id);
``` ```
**It is required** to query global `id` for every GraphQL type that has an `id` in the schema:
```javascript
query allReleases(...) {
project(...) {
id // Project has an ID in GraphQL schema so should fetch it
releases(...) {
nodes {
// Release has no ID property in GraphQL schema
name
tagName
tagPath
assets {
count
links {
nodes {
id // Link has an ID in GraphQL schema so should fetch it
name
}
}
}
}
pageInfo {
// PageInfo no ID property in GraphQL schema
startCursor
hasPreviousPage
hasNextPage
endCursor
}
}
}
}
```
## Immutability and cache updates ## Immutability and cache updates
From Apollo version 3.0.0 all the cache updates need to be immutable. It needs to be replaced entirely From Apollo version 3.0.0 all the cache updates need to be immutable. It needs to be replaced entirely
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment