diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index ab4ae8dca..aaaade2fa 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -159,7 +159,9 @@ export default function ParameterComponent({ disabled={disabled} value={data.node.template[name]?.value ?? ""} onChange={(t: string) => { - data.node.template[name].value = t; + if(data.node.template[name]?.value){ + data.node.template[name].value = t; + } }} > ) : ( diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 368b3c2ed..6e3aa6e67 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -22,7 +22,6 @@ export default function GenericNode({ const showError = useRef(true); const { types, deleteNode } = useContext(typesContext); const Icon = nodeIcons[types[data.type]]; - console.log(data) if (!Icon) { if (showError.current) { setErrorData({ diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index f8a9f942e..b7a8a0bf0 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -17,6 +17,12 @@ export default function InputFileComponent({ } }, [disabled, onChange]); + function attachFile(fileReadEvent: ProgressEvent) { + fileReadEvent.preventDefault(); + const file = fileReadEvent.target.result; + console.log(file); + } + const handleButtonClick = () => { const input = document.createElement("input"); input.type = "file"; @@ -25,7 +31,10 @@ export default function InputFileComponent({ input.multiple = false; input.onchange = (e: Event) => { const file = (e.target as HTMLInputElement).files?.[0]; + const fileData = new FileReader(); + fileData.onload = attachFile; if (file && file.name.endsWith(".json")) { + fileData.readAsDataURL(file); setMyValue(file.name); onChange(file.name); } else {