Replies: 2 comments 12 replies
-
The others should eventually also resolve, but all of them should resolve with the same result, from the first query that was started. If that is not the case, please create a reproduction, that would be a bug. But generally: the point of queries is that cache results for the same request are shared. If you want completely independent results for multiple calls with the same argument, you probably should be using a mutation instead. |
Beta Was this translation helpful? Give feedback.
-
@phryneas is there a way to execute these in their individual components without using the lazy version? I want to fire these off for each component. But also need to save their return so as to not make the same request for the same response which might be done several dozen times if I were to simply use the normal query hook. Also coming back to the same page would then refire them all again. So saving their response to state to see if the requests have been saved before to not send out the request again would be beneficial. So it would have to be something that wouldn't be fired until called, not set directly on the root of the component but in a useEffect |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The problem: When doing multiple requests to the same endpoint (5 per sec), useLazyQueryHook will return a response only with the latest query with status set to 'fulfilled' and response data, while other requests made before are stuck with status 'pending' and without response data.
Desired functionality: The lazy query hook does not overwrite the previous returns (if overwrite is the case) but returns data from each query which can be accessed in a useEffect hook f.ex. Is this possibly not the correct approach for this use case when using RTK?
I have the following endpoint within createAPI...
... but when using the generated useLazyGetLoggerCheckQuery hook like so and making approx 5 requests / sec with
runLoggerChecks({loggerId: XXXXX})
only the most recent query is returned with data and status 'fulfilled'.Beta Was this translation helpful? Give feedback.
All reactions