How to make the query optimistic?
See original GitHub issueI can’t figure out, how to make the queries optimistic. I’m using the API like this:
const deleteContact = useMutation(gql(mutations.deleteContact));
handleClick = async id => {
const res = await deleteContact({ variables: { input: { id } } });
console.log('Delete Contact', res);
}
And res has Symbol(isOptimistic): false. How can I make that true?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
React Query Tutorial - 24 - Optimistic Updates - YouTube
Courses - https://learn.codevolution.dev/ Support UPI - https://support.codevolution.dev/ Support PayPal ...
Read more >Optimistic Updates | TanStack Query Docs
To do this, useMutation 's onMutate handler option allows you to return a value that will later be passed to both onError and...
Read more >Optimistic UI With React Query - Mehdi Namvar - Medium
It is really easy to use. I love React Query! Not only you can control every detail of how you fetch, cache, and...
Read more >Optimistic mutation results - Apollo GraphQL Docs
When viewing the example, try adding an item to the to-do list. Notice that the item appears in the list instantly, even though...
Read more >React Query and optimistic updates - Daily Dev Tips
React Query optimistic updates permalink · mutation gets triggers · onMutate temporary adds the new Pokemon to the list · mutation returns a...
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

Great! Yeah, the manual cache update stuff always feels a bit cumbersome, even with “plain” Apollo.
@lukasluecke It works! It’s super verbose, but I guess that is the best that it can be at the moment. Thank you for your help 🚀