Can't perform a React state update on an unmounted component.
See original GitHub issueDescribe the bug
Occasionally, when I drop a draggable, I get this error:
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 DraggableCard (created by HideCardOnRemove)
| warningWithoutStack | @ | react-dom.development.js:545
-- | -- | -- | --
| warnAboutUpdateOnUnmountedFiberInDEV | @ | react-dom.development.js:23177
| scheduleUpdateOnFiber | @ | react-dom.development.js:21394
| dispatchAction | @ | react-dom.development.js:15816
| (anonymous) | @ | useCollector.js:38
| handleChange | @ | DragDropMonitorImpl.js:51
| dispatch | @ | redux.js:229
| (anonymous) | @ | DragDropManagerImpl.js:99
| HTML5Backend.endDragIfSourceWasRemovedFromDOM | @ | HTML5Backend.js:81
I looked at existing issues such as #1435 and it didn’t seem applicable. I’m making a context state change in end
, but no state changes.
Reproduction
It seems intermittent, it doesn’t happen every time, so I’m hoping that the stacktrace and description can shed some light. If not, I’m happy to try and debug further.
Expected behavior No warning
Screenshots
Desktop (please complete the following information):
- OS: [e.g. iOS] macOS
- Browser [e.g. chrome, safari]: Chrome
- Version [e.g. 22]: Chrome is 76, macOS is 10.14.6
Additional context None
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:7
Top Results From Across the Web
Can't perform a React state update on an unmounted ...
Here is a simple solution for this. This warning is due to when we do some fetch request while that request is in...
Read more >Can't perform a react state update on an unmounted component
To solve the "Warning: Can't perform a React state update on an unmounted component", declare an isMounted boolean in your useEffect hook that...
Read more >React: Prevent state updates on unmounted components
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 component
Fix-1: Moving the state to a higher component in the hierarchy · Fix-2: Check if React has unmounted the component using the useRef...
Read more >React state update on an unmounted component - debuggr.io
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 >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
Having this bug in 2022.
Also experiencing this issue with useDrag’s collect function