fix(builder): Correctly display static links on new edges (#7851)
Fix static links on edge creationpull/7836/head^2
parent
afc8338145
commit
a1cbc101a5
|
@ -52,6 +52,7 @@ export type CustomNodeData = {
|
||||||
errors?: { [key: string]: string | null };
|
errors?: { [key: string]: string | null };
|
||||||
setErrors: (errors: { [key: string]: string | null }) => void;
|
setErrors: (errors: { [key: string]: string | null }) => void;
|
||||||
setIsAnyModalOpen?: (isOpen: boolean) => void;
|
setIsAnyModalOpen?: (isOpen: boolean) => void;
|
||||||
|
isOutputStatic?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CustomNode: FC<NodeProps<CustomNodeData>> = ({ data, id }) => {
|
const CustomNode: FC<NodeProps<CustomNodeData>> = ({ data, id }) => {
|
||||||
|
|
|
@ -274,8 +274,7 @@ const FlowEditor: React.FC<{
|
||||||
const edgeColor = getTypeColor(
|
const edgeColor = getTypeColor(
|
||||||
getOutputType(connection.source!, connection.sourceHandle!),
|
getOutputType(connection.source!, connection.sourceHandle!),
|
||||||
);
|
);
|
||||||
const sourcePos = getNode(connection.source!)?.position;
|
const sourceNode = getNode(connection.source!);
|
||||||
console.log("sourcePos", sourcePos);
|
|
||||||
const newEdge: Edge<CustomEdgeData> = {
|
const newEdge: Edge<CustomEdgeData> = {
|
||||||
id: formatEdgeID(connection),
|
id: formatEdgeID(connection),
|
||||||
type: "custom",
|
type: "custom",
|
||||||
|
@ -284,7 +283,11 @@ const FlowEditor: React.FC<{
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
color: edgeColor,
|
color: edgeColor,
|
||||||
},
|
},
|
||||||
data: { edgeColor, sourcePos },
|
data: {
|
||||||
|
edgeColor,
|
||||||
|
sourcePos: sourceNode!.position,
|
||||||
|
isStatic: sourceNode!.data.isOutputStatic,
|
||||||
|
},
|
||||||
...connection,
|
...connection,
|
||||||
source: connection.source!,
|
source: connection.source!,
|
||||||
target: connection.target!,
|
target: connection.target!,
|
||||||
|
@ -431,6 +434,7 @@ const FlowEditor: React.FC<{
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
isOutputStatic: nodeSchema.staticOutput,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export type Block = {
|
||||||
categories: Category[];
|
categories: Category[];
|
||||||
inputSchema: BlockIORootSchema;
|
inputSchema: BlockIORootSchema;
|
||||||
outputSchema: BlockIORootSchema;
|
outputSchema: BlockIORootSchema;
|
||||||
|
staticOutput: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BlockIORootSchema = {
|
export type BlockIORootSchema = {
|
||||||
|
|
Loading…
Reference in New Issue