From 2fec0ffea016455be3d6345d6033a3826aef44b0 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Tue, 28 Nov 2023 14:21:40 -0300 Subject: [PATCH] Fixed bug of uploading --- src/frontend/src/contexts/flowsContext.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/contexts/flowsContext.tsx b/src/frontend/src/contexts/flowsContext.tsx index 25696c6fe..8ce66260d 100644 --- a/src/frontend/src/contexts/flowsContext.tsx +++ b/src/frontend/src/contexts/flowsContext.tsx @@ -308,7 +308,7 @@ export function FlowsProvider({ children }: { children: ReactNode }) { let text = await file.text(); let fileData = JSON.parse(text); if ( - (fileData.is_component === undefined && isComponent === true) || + (fileData.is_component === undefined && isComponent === false) || (fileData.is_component !== undefined && fileData.is_component !== isComponent) ) { @@ -339,11 +339,10 @@ export function FlowsProvider({ children }: { children: ReactNode }) { let fileData: FlowType = await JSON.parse(text); console.log(isComponent, fileData); - if (fileData.is_component === undefined) { - reject("Your file doesn't have the is_component property."); - } else if ( - fileData.is_component !== undefined && - fileData.is_component !== isComponent + if ( + (fileData.is_component === undefined && isComponent === false) || + (fileData.is_component !== undefined && + fileData.is_component !== isComponent) ) { reject("You cannot upload a component as a flow or vice versa"); } else {