-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
"Cannot announce to unmounted node" error with state update in onDragEnd #556
Comments
Interesting. I will try to take a look soon |
Are you still experiencing this issue in the latest version? Can I please grab an updated codesandbox which demonstrates the issue? |
I am experiencing the exact same issue, trying to keeping the order from outside the component will result in an error :( |
Here is our boilerplate: https://codesandbox.io/s/k260nyxq9v Without an independent example this is hard to action |
I have since posting the issue refactored my code so I'm not experiencing the problem anymore. I will try to take a look at my old code and share a codesandbox if I have time. |
This could happen if you unmount in an onDragEnd. I have changed the behaviour from a |
@hspens did you found what is a diff? I also have the same error. |
I have the same issue when I try to keeping the order from outside the component, In specific when I send a fetch to the backend to update the order, what could be the problem? |
Will ship with #838 |
Closed by #838 |
Bug or feature request?
Bug
Expected behavior
No errors and no component unmounting.
Actual behavior
The component implementing a DragDropContext unmounts on onDragEnd events.
What version of
React
are you using?[email protected]
What version of
react-beautiful-dnd
are you running?[email protected]
What browser are you using?
Version 67.0.3396.87 (Official Build) (64-bit)
Issue tl;dr
I'm implementing a simple horizontal list with user selected items in it as a component in my app. The selected items are stored in the state of the app and are passed down as a prop to the list. When the user reorders the list a callback function is called from within "onDragEnd" to update the application state, i.e. it is the container object and not the simple horizontal list which holds the true state of the ordering of list items. Keeping the state outside the list seems to be an issue though as I'm getting a
error in Chrome when re-ordering due to the simple horizontal list component being unmounted.
Issue
Firstly, thanks for this awesome library. I must say that I was thrilled when I found it since I was specifically searching for a drag-and-drop library similar to the one used in Atlassian Jira. I'm a complete beginner in React and may have implemented this library in the wrong way but I'm still very confused as to why I'm getting this kind of error.
I want to have a table of data in my app where the user can drag-and-drop both the columns and the rows. I'm implementing this with two DragDropContext-components, one acting as the column defining the rows and one as the row defining the columns.
I used the codepen link to on github (https://codesandbox.io/s/k260nyxq9v) to give me a template of the component and created a custom one where I can send in the direction of the list as a prop. I use this "DragableList" in a container-component which holds the state of the application, i.e. data fetched from a server. The user can select columns to display in the report from a static list populated by server data. The selected items are passed down to the component created with react-beautiful-dnd through a prop (selectedKeys). The user can also remove items through the "onKeyDeselect" callback present as an "onClick" on each item in the DragableList component.
DragableList.js
The problem is that when a user alters the order of the items in the list the state in the parent of the "DragableList"-component should update its state and pass it down through the prop with "selectedKeys". But when this happens the DragableList-component seemingly unmounts with a
error in the console in Chrome. I might be wrong but I thought it would be more proper for the container object to be the true state origin and for the DragableList to set its state to that passed down as a prop by the containe and when a user updates the list in DragableList the state of the container-component alters through a callback.
It works if I update the internal state of the DragableList-component but I need to notify the parent container of that change in order to display the table data differently so I tried to use a callback instead but that introduces the issue.
The text was updated successfully, but these errors were encountered: