Skip to content

Commit

Permalink
chore: fix issue where drag and drop throws illegal invocation (#6145)
Browse files Browse the repository at this point in the history
* chore: fix issue where drag and drop throws illegal invocation

* Create dry-points-fold.md
  • Loading branch information
dindjarinjs authored Nov 18, 2024
1 parent 8703487 commit 90ea18b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-points-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aws-amplify/ui-react-core": patch
---

chore: fix issue where drag and drop throws illegal invocation
11 changes: 4 additions & 7 deletions packages/react-core/src/utils/processDroppedItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ export async function processDroppedItems(
// Filter out and process files from the data transfer items
await Promise.all(
dataTransferItems
.reduce<FileSystemEntry[]>(
(acc, { kind, webkitGetAsEntry }) =>
kind === 'file' && webkitGetAsEntry()
? [...acc, webkitGetAsEntry()!]
: acc,
[]
)
.reduce<FileSystemEntry[]>((acc, item) => {
const entry = item.webkitGetAsEntry();
return item.kind === 'file' && entry ? [...acc, entry] : acc;
}, [])
.map(processFileSystemEntry)
);

Expand Down

0 comments on commit 90ea18b

Please sign in to comment.