question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't perform a React state update on an unmounted component.

See original GitHub issue

Describe 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

CleanShot 2019-08-20 at 11 17 45@2x

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:open
  • Created 4 years ago
  • Reactions:12
  • Comments:7

github_iconTop GitHub Comments

2reactions
mooijtechcommented, Mar 26, 2022

Having this bug in 2022.

0reactions
walpolshcommented, Nov 30, 2022

Also experiencing this issue with useDrag’s collect function

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found