How can I use MutationCache to get the mutation result on different route?
I have a scenario where I use mutation to post a data and then get back the reponse. Now I have to redirect to different page and display the result from the previous mutation. Can I use the mutationCache to get the result and display on the page?
4 Replies
other-emerald•3y ago
usually there's a query that corresponds to a mutation that would be in charge of displaying data
ratty-blushOP•3y ago
But I don't have that specific query to get that data. It will only persist after successful post request to one endpoint. After the post request I cannot get the same data from any of the query.
like-gold•3y ago
I need something similar and Im thinking of taking respose from onSuccess callback and putting it in global store. But I'm not sure if that defeats the purpose of RQ in the first place? Dunno how those responses are not cached.
other-emerald•3y ago
Yeah that's a good way to do it if you need to. First time I'm seeing that use-case. It's usually resource X has a query and can be updated via a mutation.