mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-10 15:38:00 -05:00
removed more redundant logic
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user