From 6f4f4e22f0b6858822fef3878c9704a23fc78450 Mon Sep 17 00:00:00 2001 From: Adam Gough <77861281+aadamgough@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:08:56 -0800 Subject: [PATCH] fix(loop): increased max loop iterations to 1000 (#2413) --- .../panel/components/editor/hooks/use-subflow-editor.ts | 2 +- apps/sim/hooks/use-collaborative-workflow.ts | 2 +- apps/sim/stores/workflows/workflow/store.test.ts | 6 +++--- apps/sim/stores/workflows/workflow/store.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts index 85bf82200..ac3e64e8c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts @@ -26,7 +26,7 @@ const SUBFLOW_CONFIG = { }, typeKey: 'loopType' as const, storeKey: 'loops' as const, - maxIterations: 100, + maxIterations: 1000, configKeys: { iterations: 'iterations' as const, items: 'forEachItems' as const, diff --git a/apps/sim/hooks/use-collaborative-workflow.ts b/apps/sim/hooks/use-collaborative-workflow.ts index 149965ec7..6a2cfcc4d 100644 --- a/apps/sim/hooks/use-collaborative-workflow.ts +++ b/apps/sim/hooks/use-collaborative-workflow.ts @@ -1540,7 +1540,7 @@ export function useCollaborativeWorkflow() { const config = { id: nodeId, nodes: childNodes, - iterations: Math.max(1, Math.min(100, count)), // Clamp between 1-100 for loops + iterations: Math.max(1, Math.min(1000, count)), // Clamp between 1-1000 for loops loopType: currentLoopType, forEachItems: currentCollection, } diff --git a/apps/sim/stores/workflows/workflow/store.test.ts b/apps/sim/stores/workflows/workflow/store.test.ts index 21c13539c..36ae55643 100644 --- a/apps/sim/stores/workflows/workflow/store.test.ts +++ b/apps/sim/stores/workflows/workflow/store.test.ts @@ -109,7 +109,7 @@ describe('workflow store', () => { expect(state.loops.loop1.forEachItems).toEqual(['item1', 'item2', 'item3']) }) - it('should clamp loop count between 1 and 100', () => { + it('should clamp loop count between 1 and 1000', () => { const { addBlock, updateLoopCount } = useWorkflowStore.getState() // Add a loop block @@ -126,9 +126,9 @@ describe('workflow store', () => { ) // Try to set count above max - updateLoopCount('loop1', 150) + updateLoopCount('loop1', 1500) let state = useWorkflowStore.getState() - expect(state.blocks.loop1?.data?.count).toBe(100) + expect(state.blocks.loop1?.data?.count).toBe(1000) // Try to set count below min updateLoopCount('loop1', 0) diff --git a/apps/sim/stores/workflows/workflow/store.ts b/apps/sim/stores/workflows/workflow/store.ts index 8b3bd73df..5adcd6dd7 100644 --- a/apps/sim/stores/workflows/workflow/store.ts +++ b/apps/sim/stores/workflows/workflow/store.ts @@ -850,7 +850,7 @@ export const useWorkflowStore = create()( ...block, data: { ...block.data, - count: Math.max(1, Math.min(100, count)), // Clamp between 1-100 + count: Math.max(1, Math.min(1000, count)), // Clamp between 1-1000 }, }, }