Warning about memory leak from state update on an unmounted component causes tests to fail
See original GitHub issueHi. I am using the events function to make calls to my API to retrieve events. It all seems to be working but in my tests I am receiving warnings:
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 the componentWillUnmount method.
in CalendarDataProvider (created by FullCalendar)
in FullCalendar (at CalendarView.tsx:47)
...
This issue is causing my tests to fail intermittently on the pipeline, due to the test taking too long to complete.
I have provided a CSB here (simulating the API call): https://codesandbox.io/s/charming-bas-xzpp3?file=/src/App.tsx
Steps to reproduce:
- Run App.test.tsx
- See CSB console to view warnings, similar to above.
Any help to solve this issue is appreciated.
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Warning about memory leak from state update on an ... - GitHub
Warning : Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in...
Read more >How does a state update on an unmounted component cause ...
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...
Read more >Fix “Cannot perform a React state update on an unmounted ...
It happens if one performs a state update (call setState) on a component that has been unmounted. React warns us that this causes...
Read more >How to fix the React memory leak warning - DEV Community
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...
Read more >Can't perform a React state update on an unmounted ... - Reddit
Full warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @arshaw, I’ve also been running into this issue recently with the Google Calendar plugin. The delay caused by Google’s APIs cannot be changed, which causes memory leaks every time. Hopefully, this will be fixed in the near future or it will not be a viable solution to many due to this small issue.
Nothing on this?