Skip to content

Commit

Permalink
docs: add NPE check for single file dnd upload (#5813)
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Apr 7, 2020
1 parent 8af9760 commit 0a8cc1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -100,7 +100,9 @@ function ExampleDropContainerApp(props) {
invalid: true,
};
setFiles(files =>
files.map(file => (file === fileToUpload ? updatedFile : file))
files.map(file =>
file.uuid === fileToUpload.uuid ? updatedFile : file
)
);
console.log(error);
}
Expand All @@ -118,7 +120,7 @@ function ExampleDropContainerApp(props) {
if (props.multiple) {
setFiles([...files, ...newFiles]);
newFiles.forEach(uploadFile);
} else {
} else if (newFiles[0]) {
setFiles([newFiles[0]]);
uploadFile(newFiles[0]);
}
Expand Down
Expand Up @@ -91,7 +91,7 @@ function ExampleDropContainerApp(props) {
if (props.multiple) {
setFiles([...files, ...newFiles]);
newFiles.forEach(uploadFile);
} else {
} else if (newFiles[0]) {
setFiles([newFiles[0]]);
uploadFile(newFiles[0]);
}
Expand Down

0 comments on commit 0a8cc1c

Please sign in to comment.