mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Avoid sending move requests for files in moved folders (#15313)
GitOrigin-RevId: 87244b785eeeb2dadb0b4b06c9725a1ddee0562f
This commit is contained in:
parent
fa2afb7807
commit
6903d5c945
1 changed files with 6 additions and 2 deletions
|
@ -219,12 +219,16 @@ export function FileTreeActionableProvider({ reindexReferences, children }) {
|
||||||
(toFolderId, draggedEntityIds) => {
|
(toFolderId, draggedEntityIds) => {
|
||||||
dispatch({ type: ACTION_TYPES.MOVING })
|
dispatch({ type: ACTION_TYPES.MOVING })
|
||||||
|
|
||||||
// find entities and filter out no-ops
|
// find entities and filter out no-ops and nested files
|
||||||
const founds = Array.from(draggedEntityIds)
|
const founds = Array.from(draggedEntityIds)
|
||||||
.map(draggedEntityId =>
|
.map(draggedEntityId =>
|
||||||
findInTreeOrThrow(fileTreeData, draggedEntityId)
|
findInTreeOrThrow(fileTreeData, draggedEntityId)
|
||||||
)
|
)
|
||||||
.filter(found => found.parentFolderId !== toFolderId)
|
.filter(
|
||||||
|
found =>
|
||||||
|
found.parentFolderId !== toFolderId &&
|
||||||
|
!draggedEntityIds.has(found.parentFolderId)
|
||||||
|
)
|
||||||
|
|
||||||
// make sure all entities can be moved, return early otherwise
|
// make sure all entities can be moved, return early otherwise
|
||||||
const isMoveToRoot = toFolderId === fileTreeData._id
|
const isMoveToRoot = toFolderId === fileTreeData._id
|
||||||
|
|
Loading…
Reference in a new issue