Skip to content

Commit

Permalink
parallel tip
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh committed Sep 10, 2024
1 parent 706c00c commit aaae6bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/app/components/workflow/hooks/use-nodes-interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useReactFlow,
useStoreApi,
} from 'reactflow'
import { unionBy } from 'lodash-es'
import type { ToolDefaultValue } from '../block-selector/types'
import type {
Edge,
Expand Down Expand Up @@ -217,11 +218,11 @@ export const useNodesInteractions = () => {
const sourceConnectedEdges = getConnectedEdges([{ id: connectedEdges[i].source } as Node], edges).filter(edge => edge.source === connectedEdges[i].source && edge.sourceHandle === connectedEdges[i].sourceHandle)
targetNodes.push(...sourceConnectedEdges.map(edge => nodes.find(n => n.id === edge.target)!))
}

if (targetNodes.length > 1) {
const uniqTargetNodes = unionBy(targetNodes, 'id')
if (uniqTargetNodes.length > 1) {
const newNodes = produce(nodes, (draft) => {
draft.forEach((n) => {
if (targetNodes.some(targetNode => n.id === targetNode.id))
if (uniqTargetNodes.some(targetNode => n.id === targetNode.id))
n.data._inParallelHovering = true
})
})
Expand Down

0 comments on commit aaae6bd

Please sign in to comment.