[v4] Measure loading time of a query using QueryCache
Duplicated from https://github.com/TanStack/query/discussions/6730
Hey,
I'm implementing a hook that observes all queries coming to react-query and detects the ones that have poor latency. While implementing I stumbled upon an issue - loading queries have
How would I measure loading time of a query without a page reload, and if it takes more time to load than usual, to commit some kind of action? (in this case push a query to array)
This is my current implementation:
Hey,
I'm implementing a hook that observes all queries coming to react-query and detects the ones that have poor latency. While implementing I stumbled upon an issue - loading queries have
dataUpdatedAt always at 0 (because they're loading so there's no data yet). Because of that, I can only detect slow-loading queries only on a page reload when they're picked up from query cache.How would I measure loading time of a query without a page reload, and if it takes more time to load than usual, to commit some kind of action? (in this case push a query to array)
This is my current implementation:
GitHub![[v4] Measure loading time of a query using QueryCache · TanStack qu...](https://images-ext-1.discordapp.net/external/PzNNCYma7V8ty8rokb4FB3K6NadI6t1nWwKx2cQ1ISo/https/opengraph.githubassets.com/65c46df3b7671de3c4d8e8de87eda92fbef4848c70031651e2507188792baea9/TanStack/query/discussions/6730)
Hey, I'm implementing a hook that observes all queries coming to react-query and detects the ones that have poor latency. While implementing I stumbled upon an issue - loading queries have data...