Skip to content

[BUG] the version 1.2 introduced a regression #106

@buenjybar

Description

@buenjybar

Describe the bug
A clear and concise description of what the bug is.

When running the new version of react-dropzone: @14.3.5 link, I noticed a regression introduced in this library

🐛 This bug was introduced in this commit

The actual error is FileDrop-ky6DIxvn.js:5

TypeError: Cannot read properties of undefined (reading 'getFile')
    at FileDrop-ky6DIxvn.js:1:43484
    at Generator.next (<anonymous>)
    at FileDrop-ky6DIxvn.js:1:386
    at new Promise (<anonymous>)
    at E (FileDrop-ky6DIxvn.js:1:183)
    at FileDrop-ky6DIxvn.js:1:43435
    at async Promise.all (__/index 0)

Accordingly to the experimental documentation of DataTransferItem: getAsFileSystemHandle() method MDN

A Promise.
If the item's kind property is "file", and this item is accessed in the dragstart or drop event handlers, then the returned promise is fulfilled with a FileSystemFileHandle if the dragged item is a file or a FileSystemDirectoryHandle if the dragged item is a directory.
Otherwise, the promise fulfills with null.

The return value can be a promise or null, but the current code doesn't manage null values

Expected behavior
A clear and concise description of what you expected to happen.
This shouldn't crash at runtime

Desktop (please complete the following information):

  • userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Additional context
Add any other context about the problem here.

It seems that the old/legacy behavior is working as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions