Mutation refetchQueries logic is missing
See original GitHub issueThe logic found here is missing from useMutation
which is causing refetchQueries
in the shape of refetchQueries: ['nameOfQuery']
to fail.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Refetching queries in Apollo Client
To selectively refetch queries outside of a mutation, you instead use the refetchQueries method of ApolloClient , which is documented here. client.
Read more >reactjs - RefetchQueries does not invalidate cached data ...
In some cases I am using refetchQueries to make sure cache is invalidated when a mutation is done. This does work as expected, ......
Read more >Advanced Topics on Caching – Angular
apollo.mutate({ // ... insert comment mutation refetchQueries: ... Apollo Client will fire the fetchMore query and use the logic in the ...
Read more >Apollo Client Caching
For mutations that update an existing object, this linking mechanism makes most ... Specify the queries to reload with refetchQueries .
Read more >@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
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 Free
Top 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
Thanks for the example, either way I wouldn’t want to actually break my head as you did for trying to refetch a simple list, I would love to check with @trojanowski that this isn’t an edge case, is the only way to refetch queries in a simple manner, and if he agrees, i can even actually try to help with a PR.
I don’t think that this is an edge case, also, I can’t find where is said that is going to be deprecated (it is for 3.X but we’re still on Apollo 2 and there’s no other way around this), actually passing
refetchQueries
as an array of string is the only way to refetch the previous query with the same parameters previous variables, usingrefetchQueries: { query: MY_QUERY }
sends and{}
as variables so I can’t refetch it properly.EDIT: Actually, is stated as the only proper way to refetch with previous variables