|
| 1 | +/* eslint-disable react-hooks/exhaustive-deps */ |
1 | 2 | /* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */ |
2 | 3 | import classnames from 'classnames'; |
3 | 4 | import pickAttrs from '@rc-component/util/lib/pickAttrs'; |
@@ -80,10 +81,10 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p |
80 | 81 | React.useEffect(() => { |
81 | 82 | isMountedRef.current = true; |
82 | 83 | return () => { |
83 | | - isMountedRef.current = false; |
84 | 84 | abort(); |
| 85 | + isMountedRef.current = false; |
85 | 86 | }; |
86 | | - }, [abort]); |
| 87 | + }, []); |
87 | 88 |
|
88 | 89 | /** |
89 | 90 | * Process file before upload. When all the file is ready, we start upload. |
@@ -251,15 +252,12 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p |
251 | 252 | if (directory) { |
252 | 253 | const files = await traverseFileTree( |
253 | 254 | Array.prototype.slice.call(e.dataTransfer.items), |
254 | | - (_file: RcFile) => attrAccept(_file, accept), |
| 255 | + (f: RcFile) => attrAccept(f, accept), |
255 | 256 | ); |
256 | 257 | uploadFiles(files); |
257 | 258 | } else { |
258 | | - let files = [...e.dataTransfer.files].filter((file: RcFile) => attrAccept(file, accept)); |
259 | | - if (multiple === false) { |
260 | | - files = files.slice(0, 1); |
261 | | - } |
262 | | - uploadFiles(files); |
| 259 | + const allFiles = [...e.dataTransfer.files].filter((file: RcFile) => attrAccept(file, accept)); |
| 260 | + uploadFiles(multiple === false ? allFiles.slice(0, 1) : allFiles); |
263 | 261 | } |
264 | 262 | }; |
265 | 263 |
|
|
0 commit comments