fix exception when files have been dropped on destination

pull/4767/head
Joseph Izang 10 months ago
parent 4d0c363d1f
commit bf631af43d
  1. 10
      libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx

@ -58,10 +58,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
const target = await getEventTarget(event)
const items = buildMultiSelectedItemProfiles(target)
const filePaths = []
filePaths.push(target && target.path ? target.path : '/')
items.forEach((item) => filePaths.push(item.path))
props.setFilesSelected(filePaths)
console.log('onDrop', { items, target, filePaths })
// console.log('onDrop', { items, target, filePaths })
let dragDestination: any
if (!target || !target.path) {
dragDestination = {
@ -71,6 +68,11 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
} else {
dragDestination = getFlatTreeItem(target.path)
}
filePaths.push(dragDestination.path)
items.forEach((item) => filePaths.push(item.path))
props.setFilesSelected(filePaths)
if (dragDestination.isDirectory) {
if (dragSource.isDirectory) {
moveFolder(dragDestination.path, [dragSource.path])

Loading…
Cancel
Save