diff options
author | Vijay A <avijayr@protonmail.com> | 2021-07-19 07:31:06 +0530 |
---|---|---|
committer | Vijay A <avijayr@protonmail.com> | 2021-07-19 07:31:06 +0530 |
commit | 1e14f28db0cfc9cd18beb609de8d894df2d239af (patch) | |
tree | f075b110325d420549865e60184ecccaa3f01df5 | |
parent | New translations en-US.json (Chinese Simplified) (diff) | |
download | ferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.tar.gz ferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.tar.zst ferdium-app-1e14f28db0cfc9cd18beb609de8d894df2d239af.zip |
Minor refactoring to avoid leaking of objects.
-rw-r--r-- | src/components/ui/ImageUpload.js | 7 |
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); |