Skip to content

Prevent a React dev warning when a loading Query component is unmounted #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaydenseric opened this issue Sep 26, 2018 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@jaydenseric
Copy link
Owner

If you unmount a Query component (specifically the GraphQLQuery component within it) while it is still loading a query, you see a React dev warning like this:

screen shot 2018-09-26 at 3 23 12 pm

This is because a setState call happens after the request is complete to update the loading state as false, see here. This should be prevented from happening after the component has unmounted.

@jaydenseric jaydenseric added the bug Something isn't working label Sep 26, 2018
@xjamundx
Copy link

I'm doing a thing where I use the Redirect component from @reach/router and see this a lot.

@jaydenseric
Copy link
Owner Author

Yep, it's annoying but at least harmless. I hope to be able to get to it this weekend; I've recently been busy soft-launching https://enamor.app (which BTW happens to use graphql-react ✌️).

@jaydenseric
Copy link
Owner Author

jaydenseric commented Oct 18, 2018

🚢 Fixed in v3.

RyanWooldridge added a commit to RyanWooldridge/React-graphql that referenced this issue Aug 21, 2019
denisp22 pushed a commit to denisp22/graphql-react that referenced this issue Jul 27, 2023
DevHawkNov added a commit to DevHawkNov/GraphQL_React that referenced this issue Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants