-
Notifications
You must be signed in to change notification settings - Fork 787
networkStatus gets stuck on "2" (setVariables) #667
Comments
i have the same issue |
i also have the exact same issue |
Thanks @SachaG! Would anyone be able to provide a reproduction using react-apollo-error-template? 🙂 |
Is there a workaround? like using another version? |
I'm having the same issue.. Any progress? |
@hiei189 @alikhani I think this issue is similar to another one we're trying to debug (where the loading state doesn't change back), but we could still use a reproduction for this, in case it's not the same. |
Hello everybody, I encountered this problem as well and I was able to reproduce this in this repo: https://github.com/andreasgruenh/react-apollo-error-template Take a look at the PersonDisplay component. It receives an ID as prop and should render the corresponding person. To prevent some old state in the PersonDisplay component, I want it to completly unmount and remount it (by giving it a key prop). When I give this prop from the App component, everything works, when I hand this prop from mapProps HOC, it stops working. It also does not happen with react-apollo 1.0.0 |
I can try to reproduce it later when I have time. I can confirm that the issue manifests itself in [email protected]. So 1.0.0 works fine. |
@alikhani what's the latest version of apollo-client (not react-apollo) that it works with and the first version where it breaks? |
@helfer I'm importing apollo-client from react-apollo. Not sure how the dependencies work.. In react-apollo 1.0.0 where it breaks it says that it should use "^1.0.2" #L132 So I think I'm using the latest apollo-client release(1.2.2), due to the "^", on both versions. |
@alikhani can you try this again after you set the version in your package.json explicitly |
I can also confirm that this is an issue. However, I got it working by downgrading react-apollo to 1.0.0 This is my setup (working): Also using: Upgrading react-apollo makes the network status stuck in "2", thus loading is always true and my UI is showing the "loading spinner". |
@jole78 interesting! Can you tell us at exactly which version of react-apollo things start breaking? That will help us narrow down which change caused this. |
I get this when running ├─ [email protected] and it is working ok. but I couldn't make it work with react-apollo 1.2 |
@helfer sorry for the late response. Anything higher than 1.0.0 |
I can confirm I have this issue too. Had to downgrade to 1.0.* for it to work properly. |
I can confirm the issue as well. Downgrading to |
This problem is driving me crazy. If there is any way how I can provide some information to help you narrow down the problem let me know. |
Also have this problem |
Same for me ... thanks for info about downgrade, which also solved the problem for me. The following works fine:
The following does not work:
|
It seems like this was caused by #531, and indirectly by adding recycled queries in the first place. I'll take another look to see if I can figure out what's causing it based on the reproduction by @andreasgruenh. |
@helfer yeah recycled queries felt like it added in a lot of complexity / bugs. I wonder it it's worth taking a look at a different approach? |
@jbaxleyiii At this point I think recycled queries are there just for backwards compatibility to support updating queries that aren't currently being used. For folks that are using only |
@helfer I like it! |
Could you elaborate on the meaning of "queries that aren't beeing used"? Let's say I have 2 routes, on one route is a list of all cars, on the other Route there is a button to add a car. Can I still update the cars list while beeing on the add car site (list site is not mounted)? |
@helfer will correct me if I'm wrong, but I think the answer is that without recycled queries, you can do this if you use |
@andreasgruenh It's basically what @SachaG said. You can't reference the query by name, but you can update the cache using the |
good news everyone! This will be fixed in 1.4.0 which should release tomorrow! |
This is now fixed via 1.4.0! You will need to update apollo-client to the same version! |
GREAT! Works for me ... Updated to:
and problem solved! Awesome work 👍 |
I can confirm this works with I ran into this issue when refactoring my code from using multiple graphql queries to a single. Thought I had some error in my components and without being able to resolve it myself I started looking for similar issues and found this. network status got set to 2 and being stuck there when only changing the query variables calculated from props. I see it being related to query re-use which makes sense. Great job everyone in resolving this! And thanks :) |
This is still the case for me with:
Can we reopen this @jbaxleyiii? Using |
I'm still having this problem, the refetch query's networkStatus stays 2 forever, but it's only happen if after a mutation is occured |
Something I've noticed recently: when passing new options to my query container, it can get stuck on
networkStatus = 2
even once the request succeeds. Here's a short screencast to demonstrate the issue:https://cl.ly/kEWd
Note that this only seems to happen the first time these new options are passed. If I go back and forth between both pages, it'll work the second time. This is with apollo-client 1.1.2 and react-apollo 1.1.1.
Other (maybe related)
networkStatus
issues:apollographql/apollo-client#1186
#170
The text was updated successfully, but these errors were encountered: