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;
}
if (flow.data && flow.is_component) {
storeComponents[(flow.data.nodes[0].data as NodeDataType).type] = (
flow.data.nodes[0].data as NodeDataType
).node!;
storeComponents[(flow.data.nodes[0].data as NodeDataType).type] =
_.cloneDeep((flow.data.nodes[0].data as NodeDataType).node!);
return;
}
setData((prev) => {
let newData = _.cloneDeep(prev);
Object.keys(storeComponents).forEach((key) => {
newData["custom_components"][key] = storeComponents[key];
});
return newData;
});
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 />
</>
) : (
flows.map((flow, idx) => (
<CardComponent
key={idx}
flow={flow}
id={flow.id}
button={
<Link to={"/flow/" + flow.id}>
<Button
variant="outline"
size="sm"
className="whitespace-nowrap "
>
<IconComponent
name="ExternalLink"
className="main-page-nav-button"
/>
Edit Flow
</Button>
</Link>
}
onDelete={() => {
removeFlow(flow.id);
}}
/>
))
flows
.filter((flow) => !flow.is_component)
.map((flow, idx) => (
<CardComponent
key={idx}
flow={flow}
id={flow.id}
button={
<Link to={"/flow/" + flow.id}>
<Button
variant="outline"
size="sm"
className="whitespace-nowrap "
>
<IconComponent
name="ExternalLink"
className="main-page-nav-button"
/>
Edit Flow
</Button>
</Link>
}
onDelete={() => {
removeFlow(flow.id);
}}
/>
))
)}
</div>
)}