mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +00:00
feat(workflow): Enable entry node deletion and fix draft sync
Complete workflow liberalization following PR #24627: 1. Remove Start node deletion restriction by removing isUndeletable property 2. Fix draft sync blocking when no Start node exists 3. Restore isWorkflowDataLoaded protection to prevent race conditions 4. Ensure all entry nodes (Start + 3 trigger types) have equal deletion rights This allows workflows with only trigger nodes and fixes the issue where added nodes would disappear after page refresh due to sync API blocking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import { useParams } from 'next/navigation'
|
||||
import {
|
||||
useWorkflowStore,
|
||||
} from '@/app/components/workflow/store'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import {
|
||||
useNodesReadOnly,
|
||||
} from '@/app/components/workflow/hooks/use-workflow'
|
||||
@@ -35,13 +34,11 @@ export const useNodesSyncDraft = () => {
|
||||
conversationVariables,
|
||||
environmentVariables,
|
||||
syncWorkflowDraftHash,
|
||||
// isWorkflowDataLoaded,
|
||||
isWorkflowDataLoaded,
|
||||
} = workflowStore.getState()
|
||||
|
||||
if (appId && !!nodes.length) {
|
||||
const hasStartNode = nodes.find(node => node.data.type === BlockEnum.Start)
|
||||
|
||||
if (!hasStartNode)
|
||||
if (appId) {
|
||||
if (!isWorkflowDataLoaded)
|
||||
return null
|
||||
|
||||
const features = featuresStore!.getState().features
|
||||
|
||||
@@ -33,6 +33,7 @@ export const useWorkflowRefreshDraft = () => {
|
||||
}, {} as Record<string, string>))
|
||||
setEnvironmentVariables(response.environment_variables?.map(env => env.value_type === 'secret' ? { ...env, value: '[__HIDDEN__]' } : env) || [])
|
||||
setConversationVariables(response.conversation_variables || [])
|
||||
workflowStore.setState({ isWorkflowDataLoaded: true })
|
||||
}).finally(() => setIsSyncingWorkflowDraft(false))
|
||||
}, [handleUpdateWorkflowCanvas, workflowStore])
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ const metaData = genNodeMetaData({
|
||||
type: BlockEnum.Start,
|
||||
isStart: true,
|
||||
isRequired: true,
|
||||
isUndeletable: true,
|
||||
isSingleton: true,
|
||||
isTypeFixed: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user