I have a list of items. on which i click and get that items ID and get details from database according to that id. I have a form which create a new item and then refetch list of items and the also fetch the detail of latest item and show the latest item's detail.
the issue is when i create a new item and refetch list call and then instead of one network call for item there goes two network calls. One for the previous item and one for newly item. Now my UI is showing that user has selected newly item but data is showing for previous item because previous item's call took more time then the latest and state was replaced by the last call that was fullfilled.
Can someone assist me how i can cancel the previous call and only save data of the latest call instead of the last call's data in RTK Query
Showing items detail on changing seletected item