removed more redundant logic

This commit is contained in:
Adam Gough
2025-05-29 18:37:37 -07:00
parent 33ac68ba2e
commit 01881d0db4
3 changed files with 9 additions and 16 deletions

View File

@@ -40,15 +40,6 @@ export function DeployedWorkflowModal({
const { revertToDeployedState } = useWorkflowStore()
const activeWorkflowId = useWorkflowRegistry((state) => state.activeWorkflowId)
// Add instance ID to track component lifecycle
const modalOpenCount = useRef(0)
useEffect(() => {
if (isOpen) {
modalOpenCount.current += 1
}
}, [isOpen])
// Get current workflow state to compare with deployed state
const currentWorkflowState = useWorkflowStore((state) => ({
blocks: activeWorkflowId ? mergeSubblockState(state.blocks, activeWorkflowId) : state.blocks,

View File

@@ -271,12 +271,18 @@ export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
stateToUse = mergedState?.subBlocks || {}
}
const isAdvancedMode = useWorkflowStore((state) => state.blocks[id]?.advancedMode ?? false)
const isAdvancedMode = useWorkflowStore.getState().blocks[blockId]?.advancedMode ?? false
// Filter visible blocks and those that meet their conditions
const visibleSubBlocks = subBlocks.filter((block) => {
if (block.hidden) return false
// Filter by mode if specified
if (block.mode) {
if (block.mode === 'basic' && isAdvancedMode) return false
if (block.mode === 'advanced' && !isAdvancedMode) return false
}
// If there's no condition, the block should be shown
if (!block.condition) return true
@@ -526,7 +532,7 @@ export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
)}
/>
</div>
Scheduled
{scheduleInfo?.isDisabled ? 'Disabled' : 'Scheduled'}
</Badge>
</TooltipTrigger>
<TooltipContent side='top' className='max-w-[300px] p-4'>
@@ -591,7 +597,7 @@ export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
</TooltipContent>
</Tooltip>
)}
{config.longDescription && (
{config.subBlocks.some((block) => block.mode) && (
<Tooltip>
<TooltipTrigger asChild>
<Button

View File

@@ -25,13 +25,9 @@ import type { WorkflowState } from '@/stores/workflows/workflow/types'
const logger = createLogger('WorkflowPreview')
interface WorkflowPreviewProps {
// The workflow state to render
workflowState: WorkflowState
// Whether to show subblocks
showSubBlocks?: boolean
// Optional className for container styling
className?: string
// Optional height/width overrides
height?: string | number
width?: string | number
isPannable?: boolean