mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-02 16:45:08 +08:00
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:
@ -1,8 +1,7 @@
|
||||
import { Connection, Position } from '@xyflow/react';
|
||||
import { Connection, OnConnectEnd, Position } from '@xyflow/react';
|
||||
import { useCallback, useRef } from 'react';
|
||||
import { useDropdownManager } from '../canvas/context';
|
||||
import { Operator, PREVENT_CLOSE_DELAY } from '../constant';
|
||||
import useGraphStore from '../store';
|
||||
import { useAddNode } from './use-add-node';
|
||||
|
||||
interface ConnectionStartParams {
|
||||
@ -40,7 +39,6 @@ export const useConnectionDrag = (
|
||||
|
||||
const { addCanvasNode } = useAddNode(reactFlowInstance);
|
||||
const { setActiveDropdown } = useDropdownManager();
|
||||
const { setHighlightedPlaceholderEdgeId } = useGraphStore();
|
||||
|
||||
/**
|
||||
* Connection start handler function
|
||||
@ -66,8 +64,8 @@ export const useConnectionDrag = (
|
||||
/**
|
||||
* Connection end handler function
|
||||
*/
|
||||
const onConnectEnd = useCallback(
|
||||
(event: MouseEvent | TouchEvent) => {
|
||||
const onConnectEnd: OnConnectEnd = useCallback(
|
||||
(event) => {
|
||||
if ('clientX' in event && 'clientY' in event) {
|
||||
const { clientX, clientY } = event;
|
||||
setDropdownPosition({ x: clientX, y: clientY });
|
||||
@ -113,11 +111,6 @@ export const useConnectionDrag = (
|
||||
|
||||
if (newNodeId) {
|
||||
setCreatedPlaceholderRef(newNodeId);
|
||||
|
||||
if (connectionStartRef.current) {
|
||||
const edgeId = `xy-edge__${connectionStartRef.current.nodeId}${connectionStartRef.current.handleId}-${newNodeId}end`;
|
||||
setHighlightedPlaceholderEdgeId(edgeId);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate placeholder node position and display dropdown menu
|
||||
@ -154,7 +147,6 @@ export const useConnectionDrag = (
|
||||
calculateDropdownPosition,
|
||||
setActiveDropdown,
|
||||
showModal,
|
||||
setHighlightedPlaceholderEdgeId,
|
||||
checkAndRemoveExistingPlaceholder,
|
||||
removePlaceholderNode,
|
||||
hideModal,
|
||||
@ -206,13 +198,7 @@ export const useConnectionDrag = (
|
||||
removePlaceholderNode();
|
||||
hideModal();
|
||||
clearActiveDropdown();
|
||||
setHighlightedPlaceholderEdgeId(null);
|
||||
}, [
|
||||
removePlaceholderNode,
|
||||
hideModal,
|
||||
clearActiveDropdown,
|
||||
setHighlightedPlaceholderEdgeId,
|
||||
]);
|
||||
}, [removePlaceholderNode, hideModal, clearActiveDropdown]);
|
||||
|
||||
return {
|
||||
onConnectStart,
|
||||
|
||||
Reference in New Issue
Block a user