frontend-collective / frontend-collective/react-sortable-tree
Path info missing in onMoveNode (similar to issue #43)
- Dominant language
- JavaScript
- Stars
- 5k
- Forks
- 914
- PR merge metrics
- No merged PRs in 30d
Description
@fritz-c when I use the code you recommend in issue 43 and drag a node to a new parent, I get the below warning. Additionally, `node.myUniqueId` resolves to `undefined` and newParentID is empty. Does anything stand out as to what I'm missing? End goal is to know the new parent node ID.
**MY CODE**
```
this.setState({ treeData })}
canDrag={({ node }) => !node.noDragging}
getNodeKey={({ node }) => node.myUniqueId}
onMoveNode={({ node, path }) => {
const newParentId = path.slice(-2, -1);
alert('1: ' + node.myUniqueId + '... 2:' + newParentId);
this.commitTreePositionChange(node.myUniqueId, newParentId);
}}
...
```
**WARNING:**
```
index.js:2178 Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method of `Grid`. See https://fb.me/react-warning-keys for more information.
in DropTarget(TreeNode) (created by Grid)
in Grid (created by List)
in List (created by Scrolling(List))
in Scrolling(List) (created by AutoSizer)
in div (created by AutoSizer)
in AutoSizer (created by ReactSortableTree)
in div (created by ReactSortableTree)
in ReactSortableTree (created by DragDropContext(ReactSortableTree))
in DragDropContext(ReactSortableTree) (at KBTree.js:100)
in div (at KBTree.js:99)
in div (at KBTree.js:98)
in KBTree (at App.js:168)
in div (at App.js:160)
in div (at App.js:159)
in App (at index.js:7)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.