Dependencies: Updates @umbraco-ui/uui to 1.17.2 to fix multiple folder drag-and-drop failing (closes #21837)#21886
Conversation
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>
There was a problem hiding this comment.
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
awaitto#handleFile()and#handleFolder()method calls to serialize media item creation - Updated inline comment to clarify the purpose of awaiting these operations
|
@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. |
Includes the fix for multi-folder drop DataTransfer staleness (umbraco/Umbraco.UI#1339).
… order Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…i-folder-drag-drop
leekelleher
left a comment
There was a problem hiding this comment.
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.
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/uuibump):DataTransferItem.webkitGetAsEntry()returnsnullafter the firstawaitin a drop handler because the browser expires the drag data store. The old_getAllEntriesloop inuui-file-dropzoneawaited_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 —
awaitinUmbMediaDropzoneManager:#handleFile()and#handleFolder()were called withoutawaitin both#createMediaItemsand#createOneMediaItem. The flat item list has parent folders before their children — withoutawait, children could race ahead of parent creation on the server, causing 404 errors.Changes
@umbraco-ui/uuito^1.17.2awaitto#handleFile()and#handleFolder()calls inUmbMediaDropzoneManagerFixes #21837
Test plan
🤖 Generated with Claude Code