-
Notifications
You must be signed in to change notification settings - Fork 786
loading is always True in Query render prop #1931
Comments
I can confirm. Facing the same issue using the same versions |
Facing same problem. |
I’m seeing |
same problems please fix it. |
Experiencing the same thing here on Above you can see two consecutive queries, both returning an empty array as Network tab shows both |
After digging around This seems to be relying in |
Ok, finally discovered the underlying cause. It's this line on if (observer.next) {
if (
previouslyHadError ||
!observableQuery ||
// This is causing the issue 👇
observableQuery.isDifferentFromLastResult(resultFromStore)
) {
try {
observer.next(resultFromStore);
} catch (e) {
// Throw error outside this control flow to avoid breaking Apollo's state
setTimeout(() => {
throw e;
}, 0);
}
}
} Replacing |
I'm not using the |
I seem to be encountering this same issue even without any cache in place. Using a
|
For what it's worth, this comment from #1186 recommends passing the |
same issue
|
@nfantone you say that changing the line If we know the solution to the problem, could we make a pull request to fix it? |
The Using apollo-client 2.5.1, the original issue of the second identical data not causing loading to be set to false returns. @mac-s-g in my experiene the work around only works for 2.4.x and older |
@baleeds It's been some time now and I don't really remember details, but yours is a good question. Both approaches worked: replacing |
#2840 should help address the issues mentioned here, starting from #1931 (comment). We're hoping to have a new |
@city41 rolling back to 2.4.1 fixed the issue for now. |
We just ran into this.. Any updates on a fix? |
Could this be the fix for you: notifyOnNetworkStatusChange: true ? I works for me. |
@ciulic nope - that didn't fix. ended up having to expose the requestTime on the api so that i could make the responses distinct, which.. is very hacky |
Setting |
Confirm setting
|
Hi @hwillson I saw that (#2840) landed. From your above comment, it seems that maybe this was intended to fix the "infinite loading" when data from the network matched data in the cache. I am currently on I am curious what you think about setting that property to true by default when This is a pretty obscure bug to track down if not for this long standing issue being open, so I wonder if we can have some more sensible defaults. |
I'm still facing this problem. But this only occurs when performing 2 queries on the same component using
|
I had the same issue with giving skip directive if the variable Anyone facing the issue might also want to check if the variable they are passing is okay. I wasted a couple of good minutes trying to think it was a bug. Turns it was me all along. Damn !
|
I can confirm the issue is hapenning for us too. |
Hi everyone! It seems like some of you are having the same issue as #2899, which was fixed in the most recent versions of react-apollo 2 and 3. Please let me know if your issue has been fixed by this update, and if not, it would be very helpful to us if you could provide an up-to-date reproduction of the issue. Thanks! |
Updating to |
Work for me on Thanks @escapiststupor |
We're having the same problem. Multiple components on our pages are not updating We're using the latest (2.6.3) version, and our app is built with Stuff randomly breaks... Anybody out there that has another solution? Big problem here... |
Still with this issue
Keeps fetching data and loading is always true |
The problem outlined in #1931 (comment) was fixed just before the release of React Apollo 3, in #3313. I don't think the problems outlined in this issue thread are still an issue in React Apollo 3, but if anyone notices otherwise, and can supply a small runnable reproduction, we'll definitely take a look. @Dalejan You say you're using |
@Dalejan any chance you can put together a small runnable reproduction of this? |
@Dalejan i think you mean loading is always true when loading the same query again even when the data is in cache ? (when using cache-and-network). This is normal |
Same issue as @Dalejan "@apollo/react-hooks": "^3.0.1", |
React Apollo has been refactored to use React Hooks behind the scenes for everything, which means a lot has changed since this issue was opened (and a lot of outstanding issues have been resolved). We'll close this issue off, but please let us know if you're still encountering this problem using React Apollo >= 3.1.0. Thanks! |
Same issue, I had to roolback to version 2.5.8 (from 3.1.2). This fix it for me! |
Having the same issue with @apollo/react-hooks version 3.1.3. cc @RRicardotj |
I am using query render prop, which been wrapped by a redux render prop, which provides a new query for a new fetch. But when the new fetch been triggered, the loading is always true in the Query render prop.
expected: the loading state should be false once data has been returned
actual: the loading state is always true
It seems that the loading is always true if data is the same? but it's not consistant
apollo-client: 2.2.8
react-apollo: 2.1.3
Code:
apollo client with batchLink and cache
The text was updated successfully, but these errors were encountered: