refetchQueries after mutation
See original GitHub issueIntended outcome:
I’m trying to refetch some queries after the mutation and I expect them to be executed.
Actual outcome:
refetchQueries are not working as they are described in the docs
How to reproduce the issue:
mutate({
mutation: LOGIN_MUTATION,
variables: {
...values
},
refetchQueries: [USER_QUERY]
})
LOGIN_MUTATION and USER_QUERY are strings in graphql syntax. I don’t see USER_QUERY gets executed after the mutation.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:51 (4 by maintainers)
Top Results From Across the Web
Mutations in Apollo Client - Apollo GraphQL Docs
Refetching queries. If you know that your app usually needs to refetch certain queries after a particular mutation, you can include a refetchQueries...
Read more >Refetching Queries after Mutations - Thinkster.io
We're going to cover something called "refetching" in this lesson. You can think of refetching as the equivalent of doing a GET call...
Read more >Query refetched after a mutation doesn't trigger re-render #9270
Seeing strange behavior where useQuery hook doesn't trigger re-render when the query is included inside useMutation's refetchQueries array ...
Read more >refetchQueries after running a mutation - Stack Overflow
Every time I run this mutation, the results of the useGetMyFavouritePlacesQuery i.e the GetMyFavouritePlacesDocument got updated automatically ( ...
Read more >Handle item deletions in Apollo using refetchQueries
When making a mutation to delete an item in Apollo, there is no way to automatically mark ... Use the RetryLink in Apollo...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tokenvolt I think this may be a shape issue within refetchQueries. Can you try
The object is needed in order to support things like variable changes
From the documentation:
Also you will have to convert your
LOGIN_MUTATION
graphql strings to a GraphQL AST by using graphql-tagIt should look like this: