fix bug on import new flow
This commit is contained in:
parent
d4bb55d444
commit
0fa51db7c5
2 changed files with 4 additions and 7 deletions
|
|
@ -214,9 +214,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
let sourceHandleObject: sourceHandleType = scapeJSONParse(
|
||||
edge.sourceHandle!
|
||||
);
|
||||
sourceHandleObject.baseClasses = sourceHandleObject.baseClasses.concat(
|
||||
template["base_classes"]
|
||||
);
|
||||
sourceHandleObject.baseClasses = template["base_classes"];
|
||||
edge.sourceHandle = scapedJSONStringfy(sourceHandleObject);
|
||||
}
|
||||
});
|
||||
|
|
@ -513,7 +511,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
const extractDataFromFlow = (flow: FlowType) => {
|
||||
let data = flow?.data ? flow.data : null;
|
||||
const description = flow?.description ? flow.description : "";
|
||||
|
||||
if (data) {
|
||||
processFlowEdges(flow);
|
||||
processFlowNodes(flow);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ export function isValidConnection(
|
|||
) {
|
||||
const targetHandleObject: targetHandleType = scapeJSONParse(targetHandle!);
|
||||
const sourceHandleObject: sourceHandleType = scapeJSONParse(sourceHandle!);
|
||||
console.log(sourceHandleObject, targetHandleObject);
|
||||
if (
|
||||
targetHandleObject.inputTypes?.some(
|
||||
(n) => n === sourceHandleObject.dataType
|
||||
|
|
@ -283,9 +282,9 @@ export function updateEdgesHandleIds({
|
|||
}
|
||||
if (source && sourceNode) {
|
||||
newSource = {
|
||||
dataType: sourceNode.data.type,
|
||||
id: sourceNode.data.id,
|
||||
baseClasses: sourceNode.data.node!.base_classes,
|
||||
dataType: sourceNode.data.type,
|
||||
};
|
||||
}
|
||||
edge.sourceHandle = scapedJSONStringfy(newSource!);
|
||||
|
|
@ -334,7 +333,8 @@ export function scapedJSONStringfy(json: object): string {
|
|||
return customStringify(json).replace(/"/g, "œ");
|
||||
}
|
||||
export function scapeJSONParse(json: string): any {
|
||||
return JSON.parse(json.replace(/œ/g, '"'));
|
||||
let parsed = json.replace(/œ/g, '"');
|
||||
return JSON.parse(parsed);
|
||||
}
|
||||
|
||||
// this function receives an array of edges and return true if any of the handles are not a json string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue