Get time that last fetch occurred for query #1229
-
Hello, In my current project I need to show the time that the last fetch occurred (either initial fetch to server, or fetch to cache). I was wondering if I could somehow trigger this off of Is there an easy way to get a timestamp for when the last fetch occurred, or a recommended solution for this. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
It seems to be not very well documented, but |
Beta Was this translation helpful? Give feedback.
-
I noticed that the |
Beta Was this translation helpful? Give feedback.
It seems to be not very well documented, but
useQuery
also returns anupdatedAt: number
field that holds exactly what you want I believe: https://github.com/tannerlinsley/react-query/blob/69236d3e0bce712376767a86eac9246b304f6be6/src/core/types.ts#L215