fix: removed deployment-controls contradicting values

This commit is contained in:
Adam Gough
2025-05-31 12:39:48 -07:00
parent c8bc9dbb55
commit 9b284c82ce
2 changed files with 9 additions and 20 deletions

View File

@@ -32,11 +32,8 @@ export function DeploymentControls({
)
const isDeployed = deploymentStatus?.isDeployed || false
// Prioritize workflow-specific needsRedeployment flag, but fall back to prop if needed
const workflowNeedsRedeployment =
deploymentStatus?.needsRedeployment !== undefined
? deploymentStatus.needsRedeployment
: needsRedeployment
// Trust the parent's change detection - it has the authoritative comparison logic
const workflowNeedsRedeployment = needsRedeployment
const [isDeploying, _setIsDeploying] = useState(false)
const [isModalOpen, setIsModalOpen] = useState(false)
@@ -62,21 +59,6 @@ export function DeploymentControls({
}
}
// Update parent component when workflow-specific status changes
useEffect(() => {
if (
deploymentStatus?.needsRedeployment !== undefined &&
deploymentStatus.needsRedeployment !== needsRedeployment
) {
setNeedsRedeployment(deploymentStatus.needsRedeployment)
}
}, [
deploymentStatus?.needsRedeployment,
needsRedeployment,
setNeedsRedeployment,
deploymentStatus,
])
return (
<>
<Tooltip>

View File

@@ -276,6 +276,7 @@ export function ControlBar() {
// Subscribe to workflow and subblock changes to detect differences from deployed state
useEffect(() => {
console.log('changing subblocks values')
// Early exit: No workflow or nothing deployed = no changes possible
if (!activeWorkflowId || !deployedState) {
setChangeDetected(false)
@@ -292,14 +293,19 @@ export function ControlBar() {
// Compare current state vs deployed state
const deployedBlocks = deployedState?.blocks
console.log('deployedBlocks', deployedBlocks)
console.log('currentMergedState', currentMergedState)
if (!deployedBlocks) {
console.log('current state should be same as deployed state')
setChangeDetected(false)
return
}
// Simple JSON comparison - if different, changes detected
const hasChanges = JSON.stringify(currentMergedState) !== JSON.stringify(deployedBlocks)
console.log('hasChanges', hasChanges)
setChangeDetected(hasChanges)
}, [activeWorkflowId, deployedState, currentBlocks, subBlockValues, isLoadingDeployedState])
// Check usage limits when component mounts and when user executes a workflow
@@ -619,6 +625,7 @@ export function ControlBar() {
/**
* Render deploy button with tooltip
*/
console.log('needs redeployment BEOFRE DEPLOYMENT CONTROLS', changeDetected)
const renderDeployButton = () => (
<DeploymentControls
activeWorkflowId={activeWorkflowId}