Skip to content

Commit 6f4f4e2

Browse files
authored
fix(loop): increased max loop iterations to 1000 (#2413)
1 parent f7d2c96 commit 6f4f4e2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const SUBFLOW_CONFIG = {
2626
},
2727
typeKey: 'loopType' as const,
2828
storeKey: 'loops' as const,
29-
maxIterations: 100,
29+
maxIterations: 1000,
3030
configKeys: {
3131
iterations: 'iterations' as const,
3232
items: 'forEachItems' as const,

apps/sim/hooks/use-collaborative-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ export function useCollaborativeWorkflow() {
15401540
const config = {
15411541
id: nodeId,
15421542
nodes: childNodes,
1543-
iterations: Math.max(1, Math.min(100, count)), // Clamp between 1-100 for loops
1543+
iterations: Math.max(1, Math.min(1000, count)), // Clamp between 1-1000 for loops
15441544
loopType: currentLoopType,
15451545
forEachItems: currentCollection,
15461546
}

apps/sim/stores/workflows/workflow/store.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('workflow store', () => {
109109
expect(state.loops.loop1.forEachItems).toEqual(['item1', 'item2', 'item3'])
110110
})
111111

112-
it('should clamp loop count between 1 and 100', () => {
112+
it('should clamp loop count between 1 and 1000', () => {
113113
const { addBlock, updateLoopCount } = useWorkflowStore.getState()
114114

115115
// Add a loop block
@@ -126,9 +126,9 @@ describe('workflow store', () => {
126126
)
127127

128128
// Try to set count above max
129-
updateLoopCount('loop1', 150)
129+
updateLoopCount('loop1', 1500)
130130
let state = useWorkflowStore.getState()
131-
expect(state.blocks.loop1?.data?.count).toBe(100)
131+
expect(state.blocks.loop1?.data?.count).toBe(1000)
132132

133133
// Try to set count below min
134134
updateLoopCount('loop1', 0)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ export const useWorkflowStore = create<WorkflowStore>()(
850850
...block,
851851
data: {
852852
...block.data,
853-
count: Math.max(1, Math.min(100, count)), // Clamp between 1-100
853+
count: Math.max(1, Math.min(1000, count)), // Clamp between 1-1000
854854
},
855855
},
856856
}

0 commit comments

Comments
 (0)