Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
a36a2a10
Commit
a36a2a10
authored
Mar 04, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: handleupdate logic
parent
474c7865
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
use-node-crud.ts
...pp/components/workflow/nodes/_base/hooks/use-node-crud.ts
+19
-0
use-config.ts
web/app/components/workflow/nodes/start/use-config.ts
+3
-10
No files found.
web/app/components/workflow/nodes/_base/hooks/use-node-crud.ts
0 → 100644
View file @
a36a2a10
import
{
useWorkflow
}
from
'@/app/components/workflow/hooks'
import
type
{
CommonNodeType
}
from
'@/app/components/workflow/types'
const
useNodeCrud
=
<
T
>
(
id
:
string
,
data
:
CommonNodeType
<
T
>
)
=>
{
const
{
handleNodeDataUpdate
}
=
useWorkflow
()
const
setInputs
=
(
newInputs
:
CommonNodeType
<
T
>
)
=>
{
handleNodeDataUpdate
({
id
,
data
:
newInputs
,
})
}
return
{
inputs
:
data
,
setInputs
,
}
}
export
default
useNodeCrud
web/app/components/workflow/nodes/start/use-config.ts
View file @
a36a2a10
...
@@ -3,17 +3,10 @@ import produce from 'immer'
...
@@ -3,17 +3,10 @@ import produce from 'immer'
import
{
useBoolean
}
from
'ahooks'
import
{
useBoolean
}
from
'ahooks'
import
type
{
StartNodeType
}
from
'./types'
import
type
{
StartNodeType
}
from
'./types'
import
type
{
InputVar
}
from
'@/app/components/workflow/types'
import
type
{
InputVar
}
from
'@/app/components/workflow/types'
import
{
useWorkflow
}
from
'@/app/components/workflow/hooks'
import
useNodeCrud
from
'@/app/components/workflow/nodes/_base/hooks/use-node-crud'
const
useConfig
=
(
id
:
string
,
payload
:
StartNodeType
)
=>
{
const
useConfig
=
(
id
:
string
,
payload
:
StartNodeType
)
=>
{
const
{
handleNodeDataUpdate
}
=
useWorkflow
()
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
StartNodeType
>
(
id
,
payload
)
// const [inputs, setInputs] = useState<StartNodeType>(initInputs)
const
inputs
=
payload
const
setInputs
=
(
newInputs
:
StartNodeType
)
=>
{
handleNodeDataUpdate
({
id
,
data
:
newInputs
,
})
}
const
[
isShowAddVarModal
,
{
const
[
isShowAddVarModal
,
{
setTrue
:
showAddVarModal
,
setTrue
:
showAddVarModal
,
...
...
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