fix: this commit tries to fix issue of blank UI

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-06 23:31:06 -03:00
commit e7e510a218

View file

@ -89,11 +89,13 @@ export function TabsProvider({ children }: { children: ReactNode }) {
let cookie = window.localStorage.getItem("tabsData"); let cookie = window.localStorage.getItem("tabsData");
if (cookie && Object.keys(templates).length > 0) { if (cookie && Object.keys(templates).length > 0) {
let cookieObject: LangFlowState = JSON.parse(cookie); let cookieObject: LangFlowState = JSON.parse(cookie);
try {
cookieObject.flows.forEach((flow) => { cookieObject.flows.forEach((flow) => {
flow.data.edges.forEach((edge) => { flow.data.edges.forEach((edge) => {
edge.className = ""; edge.className = "";
edge.style = { stroke: "#555555" }; edge.style = { stroke: "#555555" };
}); });
flow.data.nodes.forEach((node) => { flow.data.nodes.forEach((node) => {
const template = templates[node.data.type]; const template = templates[node.data.type];
if (!template) { if (!template) {
@ -122,6 +124,9 @@ export function TabsProvider({ children }: { children: ReactNode }) {
setTabIndex(cookieObject.tabIndex); setTabIndex(cookieObject.tabIndex);
setFlows(cookieObject.flows); setFlows(cookieObject.flows);
setId(cookieObject.id); setId(cookieObject.id);
} catch (e) {
console.log(e);
}
} }
}, [templates]); }, [templates]);