From 2678600108ce9ecdafe3f1308fde2886f2adc8d9 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 25 Oct 2023 10:25:13 +0100 Subject: [PATCH] When the root folder is selected, ignore the selected items when dragging (#15392) GitOrigin-RevId: a43e4f668d2df8c9abe5d67bd42546eaa5496c59 --- .../js/features/file-tree/contexts/file-tree-draggable.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/features/file-tree/contexts/file-tree-draggable.jsx b/services/web/frontend/js/features/file-tree/contexts/file-tree-draggable.jsx index c92a0ef335..bac16116ff 100644 --- a/services/web/frontend/js/features/file-tree/contexts/file-tree-draggable.jsx +++ b/services/web/frontend/js/features/file-tree/contexts/file-tree-draggable.jsx @@ -83,7 +83,7 @@ export function useDraggable(draggedEntityId) { const { permissionsLevel } = useEditorContext(editorContextPropTypes) const { fileTreeData } = useFileTreeData() - const { selectedEntityIds } = useFileTreeSelectable() + const { selectedEntityIds, isRootFolderSelected } = useFileTreeSelectable() const [isDraggable, setIsDraggable] = useState(true) @@ -92,7 +92,7 @@ export function useDraggable(draggedEntityId) { item, // required, but overwritten by the return value of `begin` begin: () => { const draggedEntityIds = getDraggedEntityIds( - selectedEntityIds, + isRootFolderSelected ? new Set() : selectedEntityIds, draggedEntityId ) const draggedItems = findAllInTreeOrThrow(fileTreeData, draggedEntityIds)