diff --git a/apps/sim/app/w/[id]/components/control-bar/components/deployment-controls/components/deployed-workflow-modal.tsx b/apps/sim/app/w/[id]/components/control-bar/components/deployment-controls/components/deployed-workflow-modal.tsx index 071d1522c3..11a2dca099 100644 --- a/apps/sim/app/w/[id]/components/control-bar/components/deployment-controls/components/deployed-workflow-modal.tsx +++ b/apps/sim/app/w/[id]/components/control-bar/components/deployment-controls/components/deployed-workflow-modal.tsx @@ -1,6 +1,6 @@ 'use client' -import { useState, useMemo } from 'react' +import { useState, useMemo, useEffect } from 'react' import { AlertDialog, AlertDialogAction, @@ -13,9 +13,6 @@ import { AlertDialogTrigger, } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button' -<<<<<<< HEAD -import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' -======= import { Dialog, DialogContent, @@ -24,7 +21,6 @@ import { DialogTitle, } from '@/components/ui/dialog' import { createLogger } from '@/lib/logs/console-logger' ->>>>>>> 2e4f4a91 (fix: good except for subblocks) import { useWorkflowRegistry } from '@/stores/workflows/registry/store' import { mergeSubblockState } from '@/stores/workflows/utils' import { useWorkflowStore } from '@/stores/workflows/workflow/store' @@ -65,7 +61,12 @@ export function DeployedWorkflowModal({ const sanitizedCurrentState = useMemo(() => { if (!currentWorkflowState) return undefined; - return { + logger.info('Before current state sanitization', { + workflowId: activeWorkflowId, + blockCount: Object.keys(currentWorkflowState.blocks || {}).length + }); + + const result = { blocks: Object.fromEntries( Object.entries(currentWorkflowState.blocks || {}) .filter(([_, block]) => block && block.type) @@ -77,7 +78,14 @@ export function DeployedWorkflowModal({ edges: currentWorkflowState.edges ? [...currentWorkflowState.edges] : [], loops: currentWorkflowState.loops ? {...currentWorkflowState.loops} : {} }; - }, [currentWorkflowState]); + + logger.info('After current state sanitization', { + workflowId: activeWorkflowId, + blockCount: Object.keys(result.blocks).length + }); + + return result; + }, [currentWorkflowState, activeWorkflowId]); const sanitizedDeployedState = useMemo(() => { if (!deployedWorkflowState) return { @@ -116,6 +124,27 @@ export function DeployedWorkflowModal({ >>>>>>> 9594f7db (fix: good except for subblocks) } + useEffect(() => { + if (isOpen && activeWorkflowId) { + logger.info('DeployedWorkflowModal opened', { + workflowId: activeWorkflowId, + deployedStateBlockCount: Object.keys(deployedWorkflowState?.blocks || {}).length, + currentStateBlockCount: Object.keys(currentWorkflowState?.blocks || {}).length, + deployedStateChecksum: JSON.stringify(deployedWorkflowState).length, + currentStateChecksum: JSON.stringify(currentWorkflowState).length + }); + + // Log a sample of block IDs to verify they match expected workflow + const deployedBlockIds = Object.keys(deployedWorkflowState?.blocks || {}).slice(0, 2); + const currentBlockIds = Object.keys(currentWorkflowState?.blocks || {}).slice(0, 2); + + logger.info('State block samples', { + deployedBlockIds, + currentBlockIds + }); + } + }, [isOpen, activeWorkflowId, deployedWorkflowState, currentWorkflowState]); + return ( { - async function checkStatus() { - if (!activeWorkflowId) return - - // Skip API call in localStorage mode - if ( - typeof window !== 'undefined' && - (localStorage.getItem('USE_LOCAL_STORAGE') === 'true' || - process.env.NEXT_PUBLIC_USE_LOCAL_STORAGE === 'true' || - process.env.NEXT_PUBLIC_DISABLE_DB_SYNC === 'true') - ) { - // For localStorage mode, we already have the status in the workflow store - // Nothing more to do as the useWorkflowStore already has this information - return - } - - try { - const response = await fetch(`/api/workflows/${activeWorkflowId}/status`) - if (response.ok) { - const data = await response.json() - // Update the store with the status from the API - setDeploymentStatus( - data.isDeployed, - data.deployedAt ? new Date(data.deployedAt) : undefined - ) - setNeedsRedeployment(data.needsRedeployment) - useWorkflowStore.getState().setNeedsRedeploymentFlag(data.needsRedeployment) - } - } catch (error) { - logger.error('Failed to check workflow status:', { error }) - } - } - checkStatus() - }, [activeWorkflowId, setDeploymentStatus]) - /** * Fetches the deployed state of the workflow from the server * This is the single source of truth for deployed workflow state @@ -423,13 +388,6 @@ export function ControlBar() { return () => unsubscribe() }, []) - // Add a manual method to update the deployment status and clear the needsRedeployment flag - const updateDeploymentStatusAndClearFlag = (isDeployed: boolean, deployedAt?: Date) => { - setDeploymentStatus(isDeployed, deployedAt) - setNeedsRedeployment(false) - useWorkflowStore.getState().setNeedsRedeploymentFlag(false) - } - // Update existing API notifications when needsRedeployment changes useEffect(() => { if (!activeWorkflowId) return diff --git a/apps/sim/app/w/[id]/components/workflow-block/workflow-block.tsx b/apps/sim/app/w/[id]/components/workflow-block/workflow-block.tsx index 35b355d363..6276e3aa8a 100644 --- a/apps/sim/app/w/[id]/components/workflow-block/workflow-block.tsx +++ b/apps/sim/app/w/[id]/components/workflow-block/workflow-block.tsx @@ -275,12 +275,6 @@ export function WorkflowBlock({ id, data }: NodeProps) { 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