fix(builder): Correctly display static links on new edges (#7851)

Fix static links on edge creation
pull/7836/head^2
Krzysztof Czerwinski 2024-08-21 10:24:01 +01:00 committed by GitHub
parent afc8338145
commit a1cbc101a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -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 }) => {

View File

@ -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,
},
};

View File

@ -12,6 +12,7 @@ export type Block = {
categories: Category[];
inputSchema: BlockIORootSchema;
outputSchema: BlockIORootSchema;
staticOutput: boolean;
};
export type BlockIORootSchema = {