react-component / react-component/upload
Omit console log on undefined before upload rejections
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 323
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Description
When beforeUpload function returns a rejected promise without a value (signifying do not upload) a undefined is logged to the console. It's merely a bit of annoyance, but I don't see the value added by logging undefined. I believe the below patch would fix this by ignoring undefined rejections
diff --git a/src/AjaxUploader.jsx b/src/AjaxUploader.jsx
index 638c90f..849d051 100644
--- a/src/AjaxUploader.jsx
+++ b/src/AjaxUploader.jsx
@@ -113,7 +113,7 @@ class AjaxUploader extends Component {
}
return this.post(file);
}).catch(e => {
- console && console.log(e); // eslint-disable-line
+ console && e !== undefined && console.log(e); // eslint-disable-line
});
} else if (before !== false) {
setTimeout(() => this.post(file), 0);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the catch branch in src/AjaxUploader.jsx, where beforeUpload rejection values are logged. Confirm the behavior for a rejected promise with no value and verify that the console remains quiet in that case while other rejection values are still logged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100