Replies: 3 comments
-
Another interesting bug somewhat related to this: So I have about 16 pages worth of data. After the page mounts, the current page count in the query is 1 (due to the bug above). After the page is settled, I click a button that calls Seems like there is some sort of race condition going on here causing some query objects to be skipped or overlooked? |
Beta Was this translation helpful? Give feedback.
-
So I've hacked up an environment to repro this issue here: https://codesandbox.io/s/react-query-test-ebsco However, as you'll see, it works just fine... So I went back to my environment to test this out and what I've found is that the query stops after the first request depending on what I render. If I just return something like:
Everything works just fine. I see 16 network calls in the network tab. In my case I have a component and where it breaks is the moment I render something like:
I see only 1 network call in this case... Any idea whats going on here? Edit: This might be worth moving to discussions as I don't think this is a bug with react query but rather a bug with the way our |
Beta Was this translation helpful? Give feedback.
-
I just found the weirdest hack to fix this issue: inside useEffect, I just added a 1ms delay like so: React.useEffect(() => {
const cb = async () => {
if (query.canFetchMore) {
await delay(1);
query.fetchMore();
}
};
cb();
}); |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Just upgraded from 2.4.15 to 2.5.13 and noticed a breaking change in my application.
When using
useInfiniteQuery
and immediately callingfetchMore
to exhaust the list of resources, the request is skipped due tothis.promise
stuck in pending state. See example below:Usage:
After tracing the call with the debugger, I have found that the issue is because the promise is still stuck in the
pending
state even though it has completed and the ui has updated./src/core/query.ts#L397-L399:
To Reproduce
Steps to reproduce the behavior:
nextToken
nextToken
is returned.https://codesandbox.io/s/react-query-test-ebsco
Expected behavior
If
nextToken
is returned, I should see another call to the api.Desktop (please complete the following information):
Additional context
The functionality was broken shortly after 2.4.15 when the migration to TS occurred.
Beta Was this translation helpful? Give feedback.
All reactions