I am working with rtk query and I have 2 different sources of data:
The cached data is store inside of the api > queries > endpointname > data.
When I made a particular api call I want to update the cached data with that result. updateCachedData is not available for the query.mutation so I am not sure how this can be achieved.
Also, should I keep the copy of that cached data inside of the normal slice?
Thanks
I've tried researching the subject but its unclear. Some people state it's a good idea to keep the copy of that data inside of the normal slice and update it there but then this data will be there indefinitely.
Hmm, that sounds like here you are trying to use a mutation to keep data around for longer - and mutations are just not meant for that. A mutation is meant to make a change on the server, not more.
So I would assume that you are just using a mutation for something that should rather be a query here - if you want to trigger it a little bit later, maybe also a lazy query or a query with a skip
option.