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 };
|
||||
setErrors: (errors: { [key: string]: string | null }) => void;
|
||||
setIsAnyModalOpen?: (isOpen: boolean) => void;
|
||||
isOutputStatic?: boolean;
|
||||
};
|
||||
|
||||
const CustomNode: FC<NodeProps<CustomNodeData>> = ({ data, id }) => {
|
||||
|
|
|
@ -274,8 +274,7 @@ const FlowEditor: React.FC<{
|
|||
const edgeColor = getTypeColor(
|
||||
getOutputType(connection.source!, connection.sourceHandle!),
|
||||
);
|
||||
const sourcePos = getNode(connection.source!)?.position;
|
||||
console.log("sourcePos", sourcePos);
|
||||
const sourceNode = getNode(connection.source!);
|
||||
const newEdge: Edge<CustomEdgeData> = {
|
||||
id: formatEdgeID(connection),
|
||||
type: "custom",
|
||||
|
@ -284,7 +283,11 @@ const FlowEditor: React.FC<{
|
|||
strokeWidth: 2,
|
||||
color: edgeColor,
|
||||
},
|
||||
data: { edgeColor, sourcePos },
|
||||
data: {
|
||||
edgeColor,
|
||||
sourcePos: sourceNode!.position,
|
||||
isStatic: sourceNode!.data.isOutputStatic,
|
||||
},
|
||||
...connection,
|
||||
source: connection.source!,
|
||||
target: connection.target!,
|
||||
|
@ -431,6 +434,7 @@ const FlowEditor: React.FC<{
|
|||
),
|
||||
);
|
||||
},
|
||||
isOutputStatic: nodeSchema.staticOutput,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export type Block = {
|
|||
categories: Category[];
|
||||
inputSchema: BlockIORootSchema;
|
||||
outputSchema: BlockIORootSchema;
|
||||
staticOutput: boolean;
|
||||
};
|
||||
|
||||
export type BlockIORootSchema = {
|
||||
|
|
Loading…
Reference in New Issue