Is this how useQueries should work ? #1954
Replies: 1 comment 3 replies
-
how are you "loading measurements" when the user clicks a button? I think you would get your expected behaviour if you change the query-key whenever the user clicks the button, which will create a new cache entry, so it starts with undefined data and loading state again. if you re-use the same query key (maybe by calling |
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.
-
So, here's what I see is happening :
All good. Data is returned for each individual query and stored against the query key. The three loading states change to success.
The initial response is 'success' and the data of the previous query is returned. But thereafter, the response for the measurement data the user clicked the btn for is returned.
Is this expected behaviour? If so, is there any way to prevent it? I want to be able to show a loader and to do that I need to be able to distinguish between 'success' and 'loading'. But that is complicated when the 'next' request returns some previous 'success' value.
My assumption would be that at step 2. (fetching new data), we should see a loading state and for the data to be reset to undefined (basically 1. again) . Thanks in advance :-)
Beta Was this translation helpful? Give feedback.
All reactions