aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-07-19 07:31:06 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-07-19 07:31:06 +0530
commit1e14f28db0cfc9cd18beb609de8d894df2d239af (patch)
treef075b110325d420549865e60184ecccaa3f01df5 /src/components
parentNew translations en-US.json (Chinese Simplified) (diff)
downloadferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.tar.gz
ferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.tar.zst
ferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.zip
Minor refactoring to avoid leaking of objects.
Diffstat (limited to 'src/components')
-rw-r--r--src/components/ui/ImageUpload.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/components/ui/ImageUpload.js b/src/components/ui/ImageUpload.js
index 059610aec..bb4ea0565 100644
--- a/src/components/ui/ImageUpload.js
+++ b/src/components/ui/ImageUpload.js
@@ -26,16 +26,13 @@ export default @observer class ImageUpload extends Component {
26 26
27 dropzoneRef = null; 27 dropzoneRef = null;
28 28
29 imgPath = null;
30
31 onDrop(acceptedFiles) { 29 onDrop(acceptedFiles) {
32 const { field } = this.props; 30 const { field } = this.props;
33 31
34 acceptedFiles.forEach((file) => { 32 acceptedFiles.forEach((file) => {
35 this.imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path; 33 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path;
36
37 this.setState({ 34 this.setState({
38 path: this.imgPath, 35 path: imgPath,
39 }); 36 });
40 37
41 this.props.field.onDrop(file); 38 this.props.field.onDrop(file);