Skip to content

Commit 0258a1b

Browse files
authored
fix(loading): fix workflow detached on first load (#987)
1 parent 4d4aefa commit 0258a1b

File tree

1 file changed

+6
-2
lines changed
  • apps/sim/stores/workflows/registry

1 file changed

+6
-2
lines changed

apps/sim/stores/workflows/registry/store.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,12 @@ export const useWorkflowRegistry = create<WorkflowRegistry>()(
426426
setActiveWorkflow: async (id: string) => {
427427
const { workflows, activeWorkflowId } = get()
428428

429-
if (activeWorkflowId === id) {
430-
logger.info(`Already active workflow ${id}, skipping switch`)
429+
// Check if workflow is already active AND has data loaded
430+
const workflowStoreState = useWorkflowStore.getState()
431+
const hasWorkflowData = Object.keys(workflowStoreState.blocks).length > 0
432+
433+
if (activeWorkflowId === id && hasWorkflowData) {
434+
logger.info(`Already active workflow ${id} with data loaded, skipping switch`)
431435
return
432436
}
433437

0 commit comments

Comments
 (0)