-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Unmount after drag causes "setState on unmounted component" error #390
Comments
I think this is because of: If that synchronously changes the parent state to unmount the component, the following setState will fail. I don't think this actually affects anything beyond the setState being a noop. All the event handlers have already been removed by this time. |
+1 this is annoying |
have you find a solution to above problem |
Also having this issue. Only happens on first drag/onStop call. What's the deal with this? Anyone found anything yet? |
Fixed in #424 |
I was still able to reproduce the warning: Does anyone still experience it after #424 fix? |
I'm still experiencing it as well v4.3.1 Can see the error being shown in your sandbox as well As Tenga Mentioned, Perhaps linked to this: #130 |
It looks as though you need to https://codesandbox.io/s/epic-kilby-qxzzx?file=/src/index.js |
wow, @jsguy nice find, was it in the documentation or somewhere in the source? 🤪🤪 Thank you! There isn't an example / explicit statement for onStop, but there's references to this behavior hidden away in the readme.md Extract from readme.md
edit: I was calling a prop, that passed a parent handler, that called a redux action, that set a state, that triggered a refresh, that triggered an array.map() => {}, that deference the Draggable. Fix applied in react ts hook
|
@PathToLife I looked at the PR code: https://github.com/STRML/react-draggable/pull/424/files |
Also affects react-resizable which doesn't return false https://github.com/react-grid-layout/react-resizable/blob/master/lib/Resizable.js#L147 |
Draggable
component seems to trigger an error after it is unmounted as the result of anonStop
handler.Specifically:
It seems similar to #130.
I've made a simple repro of the issue with the latest version that you can find here.
It only seems to happen once, and any following unmounts, even on other instances of the component, do not trigger the error.
The text was updated successfully, but these errors were encountered: