From 1d20a91b6e0b55cd6b9ddf96f54d3846753ad2d6 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 1 Aug 2023 18:53:47 -0300 Subject: [PATCH] fix csv file upload bug --- src/frontend/src/components/codeTabsComponent/index.tsx | 8 ++++++-- src/frontend/src/components/inputFileComponent/index.tsx | 4 ++-- src/frontend/src/modals/EditNodeModal/index.tsx | 2 +- .../src/modals/NodeModal/components/ModalField/index.tsx | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/codeTabsComponent/index.tsx b/src/frontend/src/components/codeTabsComponent/index.tsx index 9ccdb38e4..bc9ca3a5a 100644 --- a/src/frontend/src/components/codeTabsComponent/index.tsx +++ b/src/frontend/src/components/codeTabsComponent/index.tsx @@ -432,8 +432,12 @@ export default function CodeTabsComponent({ .suffixes } onFileChange={( - k: any - ) => {}} + value: any + ) => { + t.data.node.template[ + n + ].file_path = value; + }} > diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index c03de7c47..8c9693d8c 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -66,12 +66,12 @@ export default function InputFileComponent({ const { file_path } = data; console.log("File name:", file_path); + // sets the value that goes to the backend + onFileChange(file_path); // Update the state and callback with the name of the file // sets the value to the user setMyValue(file.name); onChange(file.name); - // sets the value that goes to the backend - onFileChange(file_path); setLoading(false); }) .catch(() => { diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx index 4ec5b10f0..4b4b55568 100644 --- a/src/frontend/src/modals/EditNodeModal/index.tsx +++ b/src/frontend/src/modals/EditNodeModal/index.tsx @@ -238,7 +238,7 @@ const EditNodeModal = forwardRef( } suffixes={myData.node.template[n].suffixes} onFileChange={(t: string) => { - handleOnNewValue(t, n); + data.node.template[n].file_path = t; }} > diff --git a/src/frontend/src/modals/NodeModal/components/ModalField/index.tsx b/src/frontend/src/modals/NodeModal/components/ModalField/index.tsx index f2f566e80..4b80248db 100644 --- a/src/frontend/src/modals/NodeModal/components/ModalField/index.tsx +++ b/src/frontend/src/modals/NodeModal/components/ModalField/index.tsx @@ -142,7 +142,7 @@ export default function ModalField({ fileTypes={data.node.template[name].fileTypes} suffixes={data.node.template[name].suffixes} onFileChange={(t: string) => { - data.node.template[name].content = t; + data.node.template[name].file_path = t; }} >