fix(tabsContext.tsx): fix issue with missing return statement causing incorrect data processing

fix(tabsContext.tsx): move setData function call outside of try-catch block to ensure it always executes
fix(MainPage/index.tsx): filter out component flows from the list of flows to be rendered
This commit is contained in:
anovazzi1 2023-10-20 12:35:36 -03:00
commit a41032def7
2 changed files with 40 additions and 36 deletions

View file

@ -146,19 +146,21 @@ export function TabsProvider({ children }: { children: ReactNode }) {
return; return;
} }
if (flow.data && flow.is_component) { if (flow.data && flow.is_component) {
storeComponents[(flow.data.nodes[0].data as NodeDataType).type] = ( storeComponents[(flow.data.nodes[0].data as NodeDataType).type] =
flow.data.nodes[0].data as NodeDataType _.cloneDeep((flow.data.nodes[0].data as NodeDataType).node!);
).node!; return;
} }
setData((prev) => {
let newData = _.cloneDeep(prev);
Object.keys(storeComponents).forEach((key) => {
newData["custom_components"][key] = storeComponents[key];
});
return newData;
});
processDataFromFlow(flow, false); processDataFromFlow(flow, false);
} catch (e) {} } catch (e) {
console.log(e);
}
});
setData((prev) => {
let newData = _.cloneDeep(prev);
Object.keys(storeComponents).forEach((key) => {
newData["custom_components"][key] = storeComponents[key];
});
return newData;
}); });
} }

View file

@ -145,31 +145,33 @@ export default function HomePage(): JSX.Element {
<SkeletonCardComponent /> <SkeletonCardComponent />
</> </>
) : ( ) : (
flows.map((flow, idx) => ( flows
<CardComponent .filter((flow) => !flow.is_component)
key={idx} .map((flow, idx) => (
flow={flow} <CardComponent
id={flow.id} key={idx}
button={ flow={flow}
<Link to={"/flow/" + flow.id}> id={flow.id}
<Button button={
variant="outline" <Link to={"/flow/" + flow.id}>
size="sm" <Button
className="whitespace-nowrap " variant="outline"
> size="sm"
<IconComponent className="whitespace-nowrap "
name="ExternalLink" >
className="main-page-nav-button" <IconComponent
/> name="ExternalLink"
Edit Flow className="main-page-nav-button"
</Button> />
</Link> Edit Flow
} </Button>
onDelete={() => { </Link>
removeFlow(flow.id); }
}} onDelete={() => {
/> removeFlow(flow.id);
)) }}
/>
))
)} )}
</div> </div>
)} )}