Skip to content
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

Reports the error ' Can't perform a React state update on an unmounted component' #74

Closed
chris-peerman opened this issue Nov 8, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@chris-peerman
Copy link

index.js:1375 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in TestComponent (at App.js:23)
Uncaught (in promise) Cancel {message: undefined}

Example here test-axios-hook.zip, to use the example:

  1. Run the example
  2. In Chrome devtools click Network, and set the Throttling to 'Slow 3G'
  3. Click 'Reload' and before it completes click 'Hide'

You'll then get the following error:
image

@chris-peerman
Copy link
Author

This relates to the recent pull request #67 which was aimed at fixing this.

@simoneb simoneb added the bug Something isn't working label Nov 10, 2019
@simoneb simoneb self-assigned this Nov 10, 2019
@simoneb simoneb reopened this Nov 10, 2019
@simoneb
Copy link
Owner

simoneb commented Nov 10, 2019

@chris-peerman thanks for the repro. can you check if the latest prerelease version 1.7.2-0 fixes the issue? I tried with the repro you posted (thanks for that!) and it fixes it here. I guess you have a more complex scenario, I would like to make sure it fixes that one too before closing this and releasing a final version with the fix.

@chris-peerman
Copy link
Author

Thanks @simoneb I've tried it using the test harness. I'll integrate it soon into our app and make sure it is working there too.

@simoneb
Copy link
Owner

simoneb commented Nov 13, 2019

Fixed in 1.7.2

@simoneb simoneb closed this as completed Nov 13, 2019
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