From d912a9273c912631567fb6dea5cf68e4b2aefa0c Mon Sep 17 00:00:00 2001 From: Frederic Stahel Date: Thu, 19 Dec 2024 18:26:35 +0100 Subject: [PATCH] Update dropzone --- .../pages/detail/attachments/fileDropzone.jsx | 18 +++++++++++------- .../detail/form/borehole/geometryImport.jsx | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/client/src/pages/detail/attachments/fileDropzone.jsx b/src/client/src/pages/detail/attachments/fileDropzone.jsx index 5f75768b9..13b74de42 100644 --- a/src/client/src/pages/detail/attachments/fileDropzone.jsx +++ b/src/client/src/pages/detail/attachments/fileDropzone.jsx @@ -88,12 +88,14 @@ export const FileDropzone = props => { setDropZoneTextColor(defaultDropzoneTextColor); setDropZoneText(t(defaultText)); setFiles(prevFiles => [...prevFiles, ...acceptedFiles]); - // set filetype depending on acceptedFileTypes. if contains csv - if (acceptedFileTypes.includes("text/csv")) { - setFileType("csv"); - } - if (acceptedFileTypes.includes("application/json")) { - setFileType("json"); + + if (setFileType) { + if (acceptedFileTypes.includes("text/csv")) { + setFileType("csv"); + } + if (acceptedFileTypes.includes("application/json")) { + setFileType("json"); + } } } }, @@ -112,7 +114,9 @@ export const FileDropzone = props => { // Is called when an accepted file is removed. const removeFile = fileToRemove => { setFiles(prevFiles => prevFiles.filter(file => file !== fileToRemove)); - setFileType(null); + if (setFileType) { + setFileType(null); + } }; // Is called when the selected/dropped files are rejected diff --git a/src/client/src/pages/detail/form/borehole/geometryImport.jsx b/src/client/src/pages/detail/form/borehole/geometryImport.jsx index 74c12fe14..ca2879de2 100644 --- a/src/client/src/pages/detail/form/borehole/geometryImport.jsx +++ b/src/client/src/pages/detail/form/borehole/geometryImport.jsx @@ -114,7 +114,7 @@ const GeometryImport = ({ boreholeId }) => {