There is an error in the state of the expandKeys inside the rc-tree after the drag-and-drop sort in ant-design tree.

the state of the expandKeys inside the rc-tree after drag-and-drop sorting in ant-design tree

recurrence step:

expandKeys

expandKeys

this is what it would normally look like

clipboard.png

clipboard.png

this is the code to add child nodes

let groups = this.props.groupList.list

const { expandedKeys } = this.state    

if( !!groups ){
    groups.map( (group,index) => {
        group.isAddInp = false
        if( group.dg_id === "ready" )
            groups.splice(index,1)    
    })
}

let addChildTreeNode = {
    pId: node.dg_id,
    name: "",
    dg_id: "ready",
    isAddInp: true
}

groups.push(addChildTreeNode)

let treeData = this.buildTreeDatas(groups, "0")

if(node.dg_id !== "0" && expandedKeys.indexOf(node.dg_id) === -1 )
    expandedKeys.push(node.dg_id)

this.setState({
    treeData,
    expandedKeys,
    autoExpandParent: false
})
Mar.25,2021

personally, I don't think you put the key of the newly added node in expandedKeys .
look up the changes in state , and you'll see.
if the expandedKeys contains the newly added nodules but does not expand, you can try to add the state of the node, and then set expandedKeys .
such as

this.setState({treeData}, () => this.setState({expandedKeys}));
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0778-22d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0778-22d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?