Skip to content

Commit 9b284c8

Browse files
Adam GoughAdam Gough
authored andcommitted
fix: removed deployment-controls contradicting values
1 parent c8bc9db commit 9b284c8

2 files changed

Lines changed: 9 additions & 20 deletions

File tree

apps/sim/app/w/[id]/components/control-bar/components/deployment-controls/deployment-controls.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ export function DeploymentControls({
3232
)
3333
const isDeployed = deploymentStatus?.isDeployed || false
3434

35-
// Prioritize workflow-specific needsRedeployment flag, but fall back to prop if needed
36-
const workflowNeedsRedeployment =
37-
deploymentStatus?.needsRedeployment !== undefined
38-
? deploymentStatus.needsRedeployment
39-
: needsRedeployment
35+
// Trust the parent's change detection - it has the authoritative comparison logic
36+
const workflowNeedsRedeployment = needsRedeployment
4037

4138
const [isDeploying, _setIsDeploying] = useState(false)
4239
const [isModalOpen, setIsModalOpen] = useState(false)
@@ -62,21 +59,6 @@ export function DeploymentControls({
6259
}
6360
}
6461

65-
// Update parent component when workflow-specific status changes
66-
useEffect(() => {
67-
if (
68-
deploymentStatus?.needsRedeployment !== undefined &&
69-
deploymentStatus.needsRedeployment !== needsRedeployment
70-
) {
71-
setNeedsRedeployment(deploymentStatus.needsRedeployment)
72-
}
73-
}, [
74-
deploymentStatus?.needsRedeployment,
75-
needsRedeployment,
76-
setNeedsRedeployment,
77-
deploymentStatus,
78-
])
79-
8062
return (
8163
<>
8264
<Tooltip>

apps/sim/app/w/[id]/components/control-bar/control-bar.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ export function ControlBar() {
276276

277277
// Subscribe to workflow and subblock changes to detect differences from deployed state
278278
useEffect(() => {
279+
console.log('changing subblocks values')
279280
// Early exit: No workflow or nothing deployed = no changes possible
280281
if (!activeWorkflowId || !deployedState) {
281282
setChangeDetected(false)
@@ -292,14 +293,19 @@ export function ControlBar() {
292293

293294
// Compare current state vs deployed state
294295
const deployedBlocks = deployedState?.blocks
296+
console.log('deployedBlocks', deployedBlocks)
297+
console.log('currentMergedState', currentMergedState)
295298
if (!deployedBlocks) {
299+
console.log('current state should be same as deployed state')
296300
setChangeDetected(false)
297301
return
298302
}
299303

300304
// Simple JSON comparison - if different, changes detected
301305
const hasChanges = JSON.stringify(currentMergedState) !== JSON.stringify(deployedBlocks)
306+
console.log('hasChanges', hasChanges)
302307
setChangeDetected(hasChanges)
308+
303309
}, [activeWorkflowId, deployedState, currentBlocks, subBlockValues, isLoadingDeployedState])
304310

305311
// Check usage limits when component mounts and when user executes a workflow
@@ -619,6 +625,7 @@ export function ControlBar() {
619625
/**
620626
* Render deploy button with tooltip
621627
*/
628+
console.log('needs redeployment BEOFRE DEPLOYMENT CONTROLS', changeDetected)
622629
const renderDeployButton = () => (
623630
<DeploymentControls
624631
activeWorkflowId={activeWorkflowId}

0 commit comments

Comments
 (0)