T
TanStack3y ago
foreign-sapphire

Creating a POST as a useQuery ( orval.dev )

Hi all. I have a question and I'm going about it wrong ( any tips would go a loooong way )... I wanted to how I would go about updating a query cache in the following case: 1. Data fetched used useQuery - and the resulting object has an array with UID ids 2. I want to switch out that array of ids with the actual data 2.2 Since using the orval.dev I get a created useMutation Hook with the params as the array of IDs - because BE provided a bulk response with the data that I would either have to store into the cache somehow ) Now the question is ( kinda ): - should I try to update the cache value of the initial useQuery and switch out the array of ids with the mutation onSuccess data - or would it make more sense to write a Cache entry myself with the response data Thanks for any tips! Cheers from Austria!
1 Reply
afraid-scarlet
afraid-scarlet3y ago
Hello, we would need more context in order to be able to answer. What does the mutation do, what does it return and why do you need the response cached? Could you provide some code samples, especially of the useQuery and the useMutation in your code?

Did you find this page helpful?