Fix: Fixed the issue where the connection lines of placeholder nodes in the agent canvas could not be displayed #9869 (#10485)

### What problem does this PR solve?

Fix: Fixed the issue where the connection lines of placeholder nodes in
the agent canvas could not be displayed #9869

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-10-11 15:24:27 +08:00
committed by GitHub
parent fee757eb41
commit 313e92dd9b
5 changed files with 20 additions and 50 deletions

View File

@ -29,9 +29,8 @@ function InnerButtonEdge({
data,
sourceHandleId,
}: EdgeProps<Edge<{ isHovered: boolean }>>) {
const deleteEdgeById = useGraphStore((state) => state.deleteEdgeById);
const highlightedPlaceholderEdgeId = useGraphStore(
(state) => state.highlightedPlaceholderEdgeId,
const { deleteEdgeById, getOperatorTypeFromId } = useGraphStore(
(state) => state,
);
const [edgePath, labelX, labelY] = getBezierPath({
@ -48,12 +47,16 @@ function InnerButtonEdge({
: {};
}, [selected]);
const isTargetPlaceholder = useMemo(() => {
return getOperatorTypeFromId(target) === Operator.Placeholder;
}, [getOperatorTypeFromId, target]);
const placeholderHighlightStyle = useMemo(() => {
const isHighlighted = highlightedPlaceholderEdgeId === id;
const isHighlighted = isTargetPlaceholder;
return isHighlighted
? { strokeWidth: 2, stroke: 'var(--accent-primary)' }
? { strokeWidth: 2, stroke: 'rgb(var(--accent-primary))' }
: {};
}, [highlightedPlaceholderEdgeId, id]);
}, [isTargetPlaceholder]);
const onEdgeClick = () => {
deleteEdgeById(id);
@ -83,9 +86,10 @@ function InnerButtonEdge({
data?.isHovered &&
sourceHandleId !== NodeHandleId.Tool &&
sourceHandleId !== NodeHandleId.AgentBottom && // The connection between the agent node and the tool node does not need to display the delete button
!target.startsWith(Operator.Tool)
!target.startsWith(Operator.Tool) &&
!isTargetPlaceholder
);
}, [data?.isHovered, sourceHandleId, target]);
}, [data?.isHovered, isTargetPlaceholder, sourceHandleId, target]);
return (
<>