file-selector: [BUG] the version 1.2 introduced a regression
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.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17
Commits related to this issue
- fix: handle getFile returning null and close #106 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- fix: handle getAsFileSystemHandle resolving to null and close #106 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- fix: handle getAsFileSystemHandle resolving to null and close #106 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- Add UT to reproduces #106 — committed to buenjybar/file-selector by deleted user 2 years ago
- fix: handle getAsFileSystemHandle resolving to null and close #106 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- fix: handle getFile returning null and close #106, close #120 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- fix: handle getFile returning null and close #106, close #120 — committed to jonkoops/file-selector by rolandjitsu 2 years ago
- fix: handle getFile returning null and close #106, close #120 — committed to jonkoops/file-selector by rolandjitsu 2 years ago
- fix: handle getFile returning null and close #106, close #120 — committed to react-dropzone/file-selector by rolandjitsu 2 years ago
- fix: handle getFile returning null and close #106, close #120 — committed to jonkoops/file-selector by rolandjitsu 2 years ago
I can confirm the Fix in 2.1.2 š
Thank you @rolandjitsu and @jonkoops
Iāve also filed https://github.com/cypress-io/cypress/issues/30629 to see if the Cypress team can provide any insight.
Once https://github.com/react-dropzone/file-selector/pull/107 goes through, weāll make a bump in react-dropzone as well.