-
I have to show request time on the page. For now I'm using something like : const startTime = new Date().getTime();
//await lazy RTKQ request
const endTime = new Date().getTime();
const duration = (endTime - startTime) / 1000 and then put this in useState. (since I haven't found a better way to get request time). Everything is okay, but if the previous request finishes after the last one, then it overwrites the time also. So, is there any way to cancel previous request or maybe different approach on getting request time, so I can avoid this problem? Would be grateful for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
nvm, I was doing the wrong thing. I was taking timestamps from lazy trigger method and then write it to the state. Instead I needed to take it from useQuery directly, as you said. Then rtkq manages them correctly by itself