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:
lyzno1
2025-09-26 13:54:52 +08:00
parent cc4ba1a3a9
commit 2a1c5ff57b
3 changed files with 4 additions and 7 deletions

View File

@@ -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

View File

@@ -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])

View File

@@ -8,7 +8,6 @@ const metaData = genNodeMetaData({
type: BlockEnum.Start,
isStart: true,
isRequired: true,
isUndeletable: true,
isSingleton: true,
isTypeFixed: true,
})