From 4ae23ed0f94aec23943c08bfd714259182cfa5db Mon Sep 17 00:00:00 2001 From: zhsama Date: Thu, 23 Oct 2025 18:19:06 +0800 Subject: [PATCH] feat(workflow): remove unused trigger status logic and simplify entry node status handling --- .../_base/components/entry-node-container.tsx | 10 +++------- web/app/components/workflow/nodes/_base/node.tsx | 16 ---------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx b/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx index d3fb38269a..d458599184 100644 --- a/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx +++ b/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx @@ -13,23 +13,19 @@ type EntryNodeContainerProps = { const EntryNodeContainer: FC = ({ children, - status = 'enabled', customLabel, nodeType = 'trigger', }) => { const { t } = useTranslation() const statusConfig = useMemo(() => { - const isDisabled = status === 'disabled' const translationKey = nodeType === 'start' ? 'entryNodeStatus' : 'triggerStatus' return { - label: customLabel || (isDisabled ? t(`workflow.${translationKey}.disabled`) : t(`workflow.${translationKey}.enabled`)), - dotClasses: isDisabled - ? 'bg-components-badge-status-light-disabled-bg border-components-badge-status-light-disabled-border-inner' - : 'bg-components-badge-status-light-success-bg border-components-badge-status-light-success-border-inner', + label: customLabel || t(`workflow.${translationKey}.enabled`), + dotClasses: 'bg-components-badge-status-light-success-bg border-components-badge-status-light-success-border-inner', } - }, [status, customLabel, nodeType, t]) + }, [customLabel, nodeType, t]) return (
diff --git a/web/app/components/workflow/nodes/_base/node.tsx b/web/app/components/workflow/nodes/_base/node.tsx index 0c00030950..d97a6a5118 100644 --- a/web/app/components/workflow/nodes/_base/node.tsx +++ b/web/app/components/workflow/nodes/_base/node.tsx @@ -5,7 +5,6 @@ import type { import { cloneElement, memo, - useCallback, useEffect, useMemo, useRef, @@ -50,8 +49,6 @@ import BlockIcon from '@/app/components/workflow/block-icon' import Tooltip from '@/app/components/base/tooltip' import useInspectVarsCrud from '../../hooks/use-inspect-vars-crud' import { ToolTypeEnum } from '../../block-selector/types' -import { useTriggerStatusStore } from '../../store/trigger-status' -import { isTriggerNode } from '../../types' type NodeChildProps = { id: string @@ -73,13 +70,6 @@ const BaseNode: FC = ({ const nodeRef = useRef(null) const { nodesReadOnly } = useNodesReadOnly() - // Subscribe to trigger status for this specific node ID (reactive) - // Use useCallback to optimize selector and prevent unnecessary re-renders - const triggerStatusSelector = useCallback((state: any) => - isTriggerNode(data.type) ? (state.triggerStatuses[id] || 'disabled') : 'enabled', - [id, data.type], - ) - const triggerStatus = useTriggerStatusStore(triggerStatusSelector) const { handleNodeIterationChildSizeChange } = useNodeIterationInteractions() const { handleNodeLoopChildSizeChange } = useNodeLoopInteractions() const toolIcon = useToolIcon(data) @@ -355,14 +345,8 @@ const BaseNode: FC = ({ const isEntryNode = TRIGGER_NODE_TYPES.includes(data.type as any) || data.type === BlockEnum.Start const isStartNode = data.type === BlockEnum.Start - // Determine node status dynamically - const nodeStatus = isStartNode - ? 'enabled' // Start nodes are always enabled (green) - : triggerStatus // Use reactive trigger status - return isEntryNode ? ( {nodeContent}