🐛 fix(tabsContext.tsx): add null check for flow.data to prevent TypeError

The fix adds a null check for flow.data to prevent a TypeError when accessing the edges property.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-08 16:54:46 -03:00
commit 3785c7e610

View file

@ -90,6 +90,9 @@ export function TabsProvider({ children }: { children: ReactNode }) {
if (cookie && Object.keys(templates).length > 0) {
let cookieObject: LangFlowState = JSON.parse(cookie);
cookieObject.flows.forEach((flow) => {
if (!flow.data) {
return;
}
flow.data.edges.forEach((edge) => {
edge.className = "";
edge.style = { stroke: "#555555" };