refactor: Extract nested node ID parsing into shared utility

This commit is contained in:
zhsama
2026-01-30 22:21:08 +08:00
parent 618dde1e3d
commit bc1d3bdf57
4 changed files with 35 additions and 21 deletions

View File

@ -52,6 +52,7 @@ import {
getNodeCustomTypeByNodeDataType,
getNodesConnectedSourceOrTargetHandleIdsMap,
getTopLeftNodePosition,
parseNestedNodeId,
} from '../utils'
import { useWorkflowHistoryStore } from '../workflow-history-store'
import { useAutoGenerateWebhookUrl } from './use-auto-generate-webhook-url'
@ -350,13 +351,9 @@ export const useNodesInteractions = () => {
}, [configsMap?.flowId])
const cleanupContextGenStorage = useCallback((nodeId: string, nodeData?: Node['data']) => {
const extSeparator = '_ext_'
const extIndex = nodeId.indexOf(extSeparator)
if (extIndex > 0) {
const toolNodeId = nodeId.slice(0, extIndex)
const paramKey = nodeId.slice(extIndex + extSeparator.length)
clearContextGenStorageByParam(toolNodeId, paramKey)
}
const parsed = parseNestedNodeId(nodeId)
if (parsed)
clearContextGenStorageByParam(parsed.parentId, parsed.paramKey)
if (nodeData?.type !== BlockEnum.Tool)
return