Skip to content

Commit 90ea18b

Browse files
authored
chore: fix issue where drag and drop throws illegal invocation (#6145)
* chore: fix issue where drag and drop throws illegal invocation * Create dry-points-fold.md
1 parent 8703487 commit 90ea18b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.changeset/dry-points-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@aws-amplify/ui-react-core": patch
3+
---
4+
5+
chore: fix issue where drag and drop throws illegal invocation

packages/react-core/src/utils/processDroppedItems.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,10 @@ export async function processDroppedItems(
4848
// Filter out and process files from the data transfer items
4949
await Promise.all(
5050
dataTransferItems
51-
.reduce<FileSystemEntry[]>(
52-
(acc, { kind, webkitGetAsEntry }) =>
53-
kind === 'file' && webkitGetAsEntry()
54-
? [...acc, webkitGetAsEntry()!]
55-
: acc,
56-
[]
57-
)
51+
.reduce<FileSystemEntry[]>((acc, item) => {
52+
const entry = item.webkitGetAsEntry();
53+
return item.kind === 'file' && entry ? [...acc, entry] : acc;
54+
}, [])
5855
.map(processFileSystemEntry)
5956
);
6057

0 commit comments

Comments
 (0)