How to chain two GraphQL queries in sequence using Apollo Client

The props added by your firstQuery component will be available to the component below (inside) it, so you can do something like: export default compose( graphql(firstQuery, { name: ‘firstQuery’ }), graphql(secondQuery, { name: ‘secondQuery’, skip: ({ firstQuery }) => !firstQuery.data, options: ({firstQuery}) => ({ variables: { var1: firstQuery.data.someQuery.someValue } }) }) )(withRouter(TestPage)) Notice that we … Read more

Auto-update of apollo client cache after mutation not affecting existing queries

From the docs: If a mutation updates a single existing entity, Apollo Client can automatically update that entity’s value in its cache when the mutation returns. To do so, the mutation must return the id of the modified entity, along with the values of the fields that were modified. Conveniently, mutations do this by default … Read more