-
Notifications
You must be signed in to change notification settings - Fork 786
loading
stuck true after variable change
#170
Comments
Can you create a repo or a failing test? |
@jbaxleyiii Sure. I created a failing mock demo at https://github.com/sgoll/react-apollo-170. Please let me know if that helps. |
try to replicate apollographql#170 and new issue on apollographql#61
Fixed with #191 |
I'm having this error after last update. had to downgrade. |
I've been running into the same issue. Could this be related to query response batching somehow? Maybe it's a coincidence, but I've noticed that when the infinite situation happens, the query response is always sent back from the server as a stand-alone result. Whereas in scenarios where everything works as expected, it's always batched with the results of another query (I happen to have multiple separate query containers on the same page). |
I highly doubt that this is related to batching. More likely it has something to do with fragments, where Apollo Client gets the result from the server, writes it to the store, then reads it back, but still thinks it only has partial data, and thus doesn't notify the observer. If someone can provide a reproduction, we should be able to get this fixed pretty quickly @hiei189 @SachaG |
Is there a guide on how to best provide reproductions? I seem to remember there was a sample app you could use? |
@helfer @SachaG |
@thebigredgeek I think this is a reproduction of the same issue that we tried to debug together a while back. Can you take a quick look at the video and tell me if you think my assessment is correct? The problem here is also due to a discrepancy between the If you want some mystery to solve, this could be an interesting puzzle. I took a quick look but couldn't get to the bottom of it yet, and I won't have time to look again before the weekend. |
@helfer yeah this is the EXACT issue, though I haven't encountered it in a while (ever since rebuilding the product). |
geez, this is the issue that will never end 👎 |
@helfer @thebigredgeek I setup an error repor #666 |
If I have to load two queries with different variables (just different in one key) and use the { branch } from recompose to get around the loading, somehow it will get stuck in loading as well but only between loading of pages that has already been loaded (using nextjs). Which means it is loading the page in the client only. Had to downgrade to 0.8.3 to remove the infinite loading. |
Alright, small update: I've figured out that for the reproduction by @comus the issue doesn't occur without recycling observable queries. It's pretty hard to track down what the exact issue is, but it must have something to do with parameters not correctly being updated when a query is recycled. That's all I know so far, I'll keep poking around until I find the bug. 🐞 |
I am having the exact same issue here, renaming the query does not solve the issue, a full page refresh does work though. |
Upgrading to the latest version seemed to solve it for me.
…On Wed, 6 Sep 2017 at 04:48, Morphexe ***@***.***> wrote:
I am having the exact same issue here, renaming the query does not solve
the issue, a full page refresh does work though.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#170 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABbfqrxh6I3pbTEXwjjW7T10NDnR48ILks5sfggZgaJpZM4Js-Q8>
.
|
I can reproduce the issue on |
Having the same issue, has there been any progress resolving this one? |
same issue ! any working on this? |
I have been moving my apollo HOC one level higher in the react tree to dodge the issue. But it comes with some tradeoff. I wish I could put it as close as where the data is needed. @kien8995 The issue has been open for a year and have around 20 people involved. I'm sure the maintainers are aware of this issue. So either they miss a reproduction example and I understand it. Or there is a much larger core issue related to the design of the project. |
Also just ran into this issue... tried the naming workaround but couldn't get that to work. @oliviertassinari could you describe your workaround? not sure I followed Something I've noticed with this issue is that the query that causes In Redux, the events are: What I believe they should be: The two issues you can see here:
|
Just found this solution, over on apollographql/apollo-client#1186 ... set |
thanks @mattfysh Where do you set it? inside the constructor of ApolloClient or inside each and every query decorator? |
@cyrus-za I'm setting it on just the affected query component right now |
thanks @mattfysh 👍 it works ! |
Thanks @mattyfish
…On Tue, Sep 19, 2017 at 3:25 PM Kien Tran ***@***.***> wrote:
thanks @mattfysh <https://github.com/mattfysh> 👍 it works !
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#170 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwqZeUa1cUPNRScu91I8LyB71_d20tHks5sj8C8gaJpZM4Js-Q8>
.
|
|
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo! |
This issue has been automatically closed because it has not had recent activity after being marked as no recent activyt. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo! |
I have this same problem here. Any progress in this issue? |
I just ran into this issue as well. Setting |
Still having this issue with react-apollo 2.04, and setting |
Just hit this bug as well. My scenario is very similar to that of @cyrus-za and @oliviertassinari. I managed to isolate the kinds of updates that result in loading being stuck to We are using react-apollo 1.4.16 and apollo-client 2.3.5. Our scenario: I isolated 3 conditions that are necessary for it to be stuck:
Like others have noted before me, the queries execute without errors, the data is in the cache, it is just that when the data is loaded my page is not updated by the |
I can confirm that this bug occurs on when conditions above specified by @andrewpeterprifer are met. Setting Maybe it'd be worth to write about this issue in the official docs? |
Any progress on this? Ran into the issue as well and setting notifyOnNetworkStatusChange can't be the answer. |
use the new Query Component and dont do a query while exporting the component: avoid something like this
you will also face some bugs with the fetchPolicy settings that will just not work here. e.g. you load a component and you revisit it but you get no updates. |
Base on the NetworkStatus Codes apparently the loading state come from <Query
notifyOnNetworkStatusChange={true}
query={/**/}
>
{
({networkStatus, error, data}) => {
let loading = !(networkStatus === 7 || networkStatus === 8);
if(loading) return <h1>Loading: { `${loading }` }</h1>
return <h1>{data.name}</h1>
}
}
</Query> be aware the code 7 mean that there is not query in the fligh and everything is fine (Like the meme), and the code 8 mean that there is not query in the fligh but got an error, so in both cases the request is complete, negating both cases |
FYI: I am able to recreate this issue with "react-apollo": "2.5.5" - notifyOnNetworkChange solves the problem, but obviously not ideal. |
I've had the same issue. Since it only happens when my back end sends the same response twice in a row, I make sure it never sends the same response twice in a row. I happened to have a "hello(name:S)" method which returned "Hello, S", which we had been using for early testing. So I changed my query from Then I generate a unique string — for my application, the millisecond clock is plenty unique — and pass it as |
I have the following problem: when the props of my GraphQL-connected component change, and I use one of the props in the options (as variables),
loading
is stuck to the valuetrue
whenever both the previous value and the current value resolve to no result.Here is an example:
Here, during the initial render, everything is fine:
Demo
receives{ loading: true, stuff: null }
. After some milliseconds, this is changed to{ loading: false, stuff: null }
.However, when the prop is updated,
Demo
receives{ loading: true, stuff: null }
and it gets stuck there, even though the network request completed as did the first one.The problem happens with
react-apollo
version 0.4.7 as well as 0.4.6. It does not happen whenever the first fetch did return an object (i.e.stuff
was something other thannull
).The text was updated successfully, but these errors were encountered: