Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const moveNode = () => {
var node = nodeToMove.node
onChange(addNodeUnderParent({
treeData: removeNodeAtPath({
treeData: treeData,
path: nodeToMove.path,
getNodeKey
}),
parentKey: parentNode.path[parentNode.path.length - 1],
expandParent: true,
getNodeKey,
newNode: node
}).treeData)
setNodeToMove(undefined)
setParentNode(undefined)
}
<button> this.setState(state => ({
treeData: removeNodeAtPath({
treeData:
state.treeData,
path,
getNodeKey,
}),
}))}
>X</button>,
return {
...state,
id: state.id + 1,
components: newComponent
}
case types.UPDATE_COMPONENTS:
const updateState = Object.assign({}, state, {components: action.payload});
return updateState;
case types.DELETE_COMPONENT:
const key = action.payload.key;
const path = action.payload.path;
return {
...state,
components: removeNodeAtPath({
treeData: state.components,
path,
getNodeKey: key
})
}
case types.ADD_CHILD:
const copy = Object.assign({}, state)
const key1 = action.payload.key;
const path1 = action.payload.path;
return {
...state,
components: addNodeUnderParent({
treeData: copy.components,
parentKey: path1[path1.length - 1],
expandParent: true,
onConfirm={() => {
const newSortableNavigationTree = removeNodeAtPath({
treeData: sortableNavigationTree,
path,
getNodeKey: this.getNodeKey
});
onSetSortableNavigationTree(newSortableNavigationTree);
}}
>
const deleteNode = ({ path }) => {
onNodeSelect({})
setTreeData(removeNodeAtPath({
treeData: treeData,
path,
getNodeKey,
}));
}
() => ({
...this.state,
items: removeNodeAtPath({
treeData: this.state.items,
path: props.path,
getNodeKey,
}),
categories: [...this.state.categories],
pages: [...this.state.pages],
}),
() => {
this.setState(state => ({
treeData: removeNodeAtPath({
treeData: state.treeData,
path,
getNodeKey,
}),
}))
}
return this.setState(state => ({
treeData: removeNodeAtPath({
treeData: state.treeData,
path: path,
getNodeKey: this.getNodeKey,
}),
}))
}
this.setState(state => ({
treeData: removeNodeAtPath({
treeData: state.treeData,
path,
getNodeKey,
}),
}))
}
this.setState(state => ({
treeData: removeNodeAtPath({
treeData: state.treeData,
path,
getNodeKey,
}),
}))
}