Refetching data based on another query's response
I am attempting to implement data fetching based on two queries:
positionNumbers
and positionId
. After the initial load, if there is an update in the number of positions (maybe after success in useMutation
) , I want to invalidate the positionNumbers
query key and refetch only the new index
for the positionId
query, not all previously fetched indexes. However, currently, all indexes are refetched whenever there is an update in the number of positions. How can I achieve selective refetching of only the new index for the positionId
query?
In summary, I need to selectively refetch only the new index
for the positionId
query when the number of positions changes, without refetching all previously fetched indexes. What approach should I take to achieve this?0 Replies