Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
06e1c5d6
authored
Oct 11, 2024
by
heheer
Committed by
GitHub
Oct 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: not delete edges when deleting non-deletable nodes (#2887)
parent
d52da7d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/hooks/useWorkflow.tsx
+16
-4
No files found.
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/hooks/useWorkflow.tsx
View file @
06e1c5d6
...
...
@@ -31,8 +31,6 @@ import {
Input_Template_Node_Width
}
from
'@fastgpt/global/core/workflow/template/input'
;
import
{
FlowNodeItemType
}
from
'@fastgpt/global/core/workflow/type/node'
;
import
{
getHandleId
}
from
'@fastgpt/global/core/workflow/utils'
;
import
{
IfElseResultEnum
}
from
'@fastgpt/global/core/workflow/template/system/ifElse/constant'
;
/*
Compute helper lines for snapping nodes to each other
...
...
@@ -439,6 +437,15 @@ export const useWorkflow = () => {
onNodesChange
([
change
]);
// Remove the edges connected to the node
const
nodeEdges
=
edges
.
filter
((
edge
)
=>
edge
.
source
===
nodeId
||
edge
.
target
===
nodeId
);
onEdgesChange
(
nodeEdges
.
map
<
EdgeRemoveChange
>
((
edge
)
=>
({
type
:
'remove'
,
id
:
edge
.
id
}))
);
return
;
});
const
handleSelectNode
=
useMemoizedFn
((
change
:
NodeSelectionChange
)
=>
{
...
...
@@ -538,9 +545,14 @@ export const useWorkflow = () => {
const
handleEdgeChange
=
useCallback
(
(
changes
:
EdgeChange
[])
=>
{
onEdgesChange
(
changes
);
// If any node is selected, don't remove edges
const
changesFiltered
=
changes
.
filter
(
(
change
)
=>
!
(
change
.
type
===
'remove'
&&
nodes
.
some
((
node
)
=>
node
.
selected
))
);
onEdgesChange
(
changesFiltered
);
},
[
onEdgesChange
]
[
nodes
,
onEdgesChange
]
);
const
onNodeDragStop
=
useCallback
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment