tajo / react-movable

🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
https://react-movable.pages.dev
MIT License
1.55k stars 51 forks source link

Warning "No items found in the List container" after unmounting #73

Closed mdrobny closed 2 years ago

mdrobny commented 3 years ago

Hi!

I would like to report that there seems to be a problem with proper cleanup after List component is unmounted

It always logs a warning: No items found in the List container. Did you forget to pass & spread thepropsparam in renderList? and it can't be fixed as far I can see (I do of course pass & spread props param).

It's very easy to reproduce in the demo page of this library 😕 😅

Steps to reproduce:

In my application React logs a big warning also

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.
    at List (webpack://<app name>/./node_modules/react-movable/lib/List.js?:54:28)

In my application it's a normal use case to unmount the List and then mount new one because I have tabs menu.

I am not familiar enough with source code to find the cause at the moment but maybe @tajo you are able to look at it?

bryan-hunter commented 2 years ago

@mdrobny ran into same issue which causes a memory leak.

fixed it in this PR:

https://github.com/tajo/react-movable/pull/77