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,10 +146,15 @@ 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;
} }
processDataFromFlow(flow, false);
} catch (e) {
console.log(e);
}
});
setData((prev) => { setData((prev) => {
let newData = _.cloneDeep(prev); let newData = _.cloneDeep(prev);
Object.keys(storeComponents).forEach((key) => { Object.keys(storeComponents).forEach((key) => {
@ -157,9 +162,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
}); });
return newData; return newData;
}); });
processDataFromFlow(flow, false);
} catch (e) {}
});
} }
function processFlowEdges(flow: FlowType) { function processFlowEdges(flow: FlowType) {

View file

@ -145,7 +145,9 @@ export default function HomePage(): JSX.Element {
<SkeletonCardComponent /> <SkeletonCardComponent />
</> </>
) : ( ) : (
flows.map((flow, idx) => ( flows
.filter((flow) => !flow.is_component)
.map((flow, idx) => (
<CardComponent <CardComponent
key={idx} key={idx}
flow={flow} flow={flow}