From c8bc9dbb5560a46ed7bb151756ababc521a33934 Mon Sep 17 00:00:00 2001 From: Adam Gough Date: Fri, 30 May 2025 20:43:51 -0700 Subject: [PATCH] fix: better detection --- apps/sim/app/w/[id]/components/control-bar/control-bar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/sim/app/w/[id]/components/control-bar/control-bar.tsx b/apps/sim/app/w/[id]/components/control-bar/control-bar.tsx index d05c0a3f3f..265ec74732 100644 --- a/apps/sim/app/w/[id]/components/control-bar/control-bar.tsx +++ b/apps/sim/app/w/[id]/components/control-bar/control-bar.tsx @@ -282,6 +282,11 @@ export function ControlBar() { return } + // Wait for deployed state to finish loading to avoid race conditions + if (isLoadingDeployedState) { + return + } + // Get current workflow state merged with user inputs const currentMergedState = mergeSubblockState(currentBlocks, activeWorkflowId) @@ -295,7 +300,7 @@ export function ControlBar() { // Simple JSON comparison - if different, changes detected const hasChanges = JSON.stringify(currentMergedState) !== JSON.stringify(deployedBlocks) setChangeDetected(hasChanges) - }, [activeWorkflowId, deployedState, currentBlocks, subBlockValues]) + }, [activeWorkflowId, deployedState, currentBlocks, subBlockValues, isLoadingDeployedState]) // Check usage limits when component mounts and when user executes a workflow useEffect(() => {