simplified useEffect

This commit is contained in:
Adam Gough
2025-05-29 17:30:52 -07:00
parent 10584e17ec
commit 33ac68ba2e

View File

@@ -257,23 +257,19 @@ export function ControlBar() {
// Fetch deployed state when workflow ID or deployment status changes
useEffect(() => {
// Clear deployed state immediately when workflow changes to prevent mixup
if (!activeWorkflowId) {
setDeployedState(null)
setIsLoadingDeployedState(false)
return
}
setDeployedState(null)
setIsLoadingDeployedState(false)
if (isDeployed) {
// When deployment status becomes true, reset the needsRedeployment flag
// When deployed - fetch the actual deployed state
setNeedsRedeployment(false)
setNeedsRedeploymentFlag(false)
fetchDeployedState()
} else {
// If workflow is undeployed, ensure deployed state remains cleared
// When not deployed - clear the deployed state
setDeployedState(null)
setIsLoadingDeployedState(false)
}