Skip to content

Dependencies: Updates @umbraco-ui/uui to 1.17.2 to fix multiple folder drag-and-drop failing (closes #21837)#21886

Merged
iOvergaard merged 5 commits intomainfrom
v17/bugfix/21837-multi-folder-drag-drop
Mar 10, 2026
Merged

Dependencies: Updates @umbraco-ui/uui to 1.17.2 to fix multiple folder drag-and-drop failing (closes #21837)#21886
iOvergaard merged 5 commits intomainfrom
v17/bugfix/21837-multi-folder-drag-drop

Conversation

@iOvergaard
Copy link
Contributor

@iOvergaard iOvergaard commented Feb 24, 2026

Summary

This fixes two separate issues that together caused only the first folder to appear when dragging multiple folders into the Media section simultaneously.

Fix 1 — UUI 1.17.2 (@umbraco-ui/uui bump):
DataTransferItem.webkitGetAsEntry() returns null after the first await in a drop handler because the browser expires the drag data store. The old _getAllEntries loop in uui-file-dropzone awaited _mkdir() on the first folder before reading subsequent items, so only folder #1 was ever retrieved. Fixed in umbraco/Umbraco.UI#1339 and published as @umbraco-ui/uui@1.17.2.

Fix 2 — await in UmbMediaDropzoneManager:
#handleFile() and #handleFolder() were called without await in both #createMediaItems and #createOneMediaItem. The flat item list has parent folders before their children — without await, children could race ahead of parent creation on the server, causing 404 errors.

Changes

  • Bumps @umbraco-ui/uui to ^1.17.2
  • Adds await to #handleFile() and #handleFolder() calls in UmbMediaDropzoneManager

Fixes #21837

Test plan

  • Drag 2+ folders (each containing files) from the OS file manager into the Media section simultaneously
  • Verify all folders and their contents appear correctly in the Media tree
  • Verify no 404 errors in the browser console/network tab
  • Verify single-file and single-folder drag-and-drop still works as before

🤖 Generated with Claude Code

When multiple folders are dragged into the Media section, the creation
handlers (#handleFile/#handleFolder) were not awaited in the batch loop.
This caused child items to attempt server operations before their parent
folders were fully created, resulting in 404 errors for subsequent items.

Adding await ensures each item is fully created before the next is
processed, which is required because child items in the flat list
reference parent folder IDs that must exist on the server.

Closes #21837

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 24, 2026 12:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a race condition that occurs when multiple folders are dragged into the Media section simultaneously. When folders containing files are dropped, the flat item list has parent folders listed before their children. Without await, child items could attempt to be created before their parent folders exist on the server, resulting in 404 errors.

Changes:

  • Added await to #handleFile() and #handleFolder() method calls to serialize media item creation
  • Updated inline comment to clarify the purpose of awaiting these operations

@leekelleher leekelleher self-requested a review March 3, 2026 15:00
@leekelleher
Copy link
Member

@iOvergaard Tested it out, but it didn't work on my local machine (latest Chrome/Windows). When attempting upload multiple folders, only the last folder I'd selected is uploaded. No 404 errors in the devtool console.

@iOvergaard iOvergaard added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code area/frontend labels Mar 9, 2026
@iOvergaard iOvergaard changed the title Media: Fix multiple folder drag-and-drop failing (closes #21837) Dependencies: Updates @umbraco-ui/uui to 1.17.2 to fix multiple folder drag-and-drop failing (closes #21837) Mar 9, 2026
iOvergaard and others added 2 commits March 9, 2026 14:15
Copy link
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out, works as described! 🚀

There's an error with the build, related to circular references (from a different PR), let's see if we can get that fixed in main.

@iOvergaard iOvergaard merged commit f2ecac6 into main Mar 10, 2026
28 of 29 checks passed
@iOvergaard iOvergaard deleted the v17/bugfix/21837-multi-folder-drag-drop branch March 10, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code release/17.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Folder Drag-and-Drop fails in Media Section

3 participants