Skip to content

Commit cc249c2

Browse files
committed
Lint
1 parent f173476 commit cc249c2

File tree

5 files changed

+19
-48
lines changed

5 files changed

+19
-48
lines changed

apps/sim/app/api/workflows/[id]/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
111111
loops: normalizedData.loops,
112112
})
113113

114-
115114
// Use normalized table data - reconstruct complete state object
116115
// First get any existing state properties, then override with normalized data
117116
const existingState =

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/import-controls/import-controls.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@ export function ImportControls({ disabled = false }: ImportControlsProps) {
107107
}
108108

109109
// Create a new workflow
110-
110+
111111
const newWorkflowId = await createWorkflow({
112112
name: `Imported Workflow - ${new Date().toLocaleString()}`,
113113
description: 'Workflow imported from YAML',
114114
workspaceId,
115115
})
116116

117117
// Import the YAML into the new workflow BEFORE navigation (creates complete state and saves directly to DB)
118-
// This avoids timing issues with workflow reload during navigation
119-
const result = await importWorkflowFromYaml(
120-
yamlContent,
121-
{
118+
// This avoids timing issues with workflow reload during navigation
119+
const result = await importWorkflowFromYaml(
120+
yamlContent,
121+
{
122122
addBlock: collaborativeAddBlock,
123123
addEdge: collaborativeAddEdge,
124124
applyAutoLayout: () => {

apps/sim/lib/workflows/db-helpers.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ export async function loadWorkflowFromNormalizedTables(
6969
parentId,
7070
extent,
7171
}
72-
73-
7472
})
7573

7674
// Convert edges to the expected format
@@ -95,20 +93,16 @@ export async function loadWorkflowFromNormalizedTables(
9593
id: subflow.id,
9694
...config,
9795
}
98-
9996
} else if (subflow.type === SUBFLOW_TYPES.PARALLEL) {
10097
parallels[subflow.id] = {
10198
id: subflow.id,
10299
...config,
103100
}
104-
105101
} else {
106102
logger.warn(`Unknown subflow type: ${subflow.type} for subflow ${subflow.id}`)
107103
}
108104
})
109105

110-
111-
112106
return {
113107
blocks: blocksMap,
114108
edges: edgesArray,
@@ -160,8 +154,6 @@ export async function saveWorkflowToNormalizedTables(
160154
extent: block.data?.extent || null,
161155
}))
162156

163-
164-
165157
await tx.insert(workflowBlocks).values(blockInserts)
166158
}
167159

@@ -223,8 +215,6 @@ export async function saveWorkflowToNormalizedTables(
223215
hasActiveWebhook: state.hasActiveWebhook,
224216
}
225217

226-
227-
228218
return {
229219
success: true,
230220
jsonBlob,
@@ -281,7 +271,6 @@ export async function migrateWorkflowToNormalizedTables(
281271
const result = await saveWorkflowToNormalizedTables(workflowId, workflowState)
282272

283273
if (result.success) {
284-
285274
return { success: true }
286275
}
287276
return { success: false, error: result.error }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ export const useWorkflowRegistry = create<WorkflowRegistry>()(
474474
})
475475
})
476476

477-
// Update subblock store for this workflow
477+
// Update subblock store for this workflow
478478
useSubBlockStore.setState((state) => ({
479479
workflowValues: {
480480
...state.workflowValues,

apps/sim/stores/workflows/yaml/importer.ts

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,6 @@ export async function importWorkflowFromYaml(
351351
},
352352
targetWorkflowId?: string
353353
): Promise<{ success: boolean; errors: string[]; warnings: string[]; summary?: string }> {
354-
355-
356354
try {
357355
// Parse YAML
358356
const { data: yamlWorkflow, errors: parseErrors } = parseWorkflowYaml(yamlContent)
@@ -368,8 +366,6 @@ export async function importWorkflowFromYaml(
368366
return { success: false, errors, warnings }
369367
}
370368

371-
372-
373369
// Get the existing workflow state (to preserve starter blocks if they exist)
374370
let existingBlocks: Record<string, any> = {}
375371

@@ -380,19 +376,18 @@ export async function importWorkflowFromYaml(
380376
if (response.ok) {
381377
const workflowData = await response.json()
382378
existingBlocks = workflowData.data?.state?.blocks || {}
383-
384-
}
385-
} catch (error) {
386-
logger.warn(`Failed to fetch existing blocks for workflow ${targetWorkflowId}:`, error)
387379
}
388-
} else {
389-
// For active workflow, use from store
390-
existingBlocks = workflowActions.getExistingBlocks()
380+
} catch (error) {
381+
logger.warn(`Failed to fetch existing blocks for workflow ${targetWorkflowId}:`, error)
391382
}
392-
393-
const existingStarterBlocks = Object.values(existingBlocks).filter(
394-
(block: any) => block.type === 'starter'
395-
)
383+
} else {
384+
// For active workflow, use from store
385+
existingBlocks = workflowActions.getExistingBlocks()
386+
}
387+
388+
const existingStarterBlocks = Object.values(existingBlocks).filter(
389+
(block: any) => block.type === 'starter'
390+
)
396391

397392
// Get stores and current workflow info
398393
const { useWorkflowStore } = require('@/stores/workflows/workflow/store')
@@ -407,8 +402,6 @@ export async function importWorkflowFromYaml(
407402
return { success: false, errors: ['No active workflow'], warnings: [] }
408403
}
409404

410-
411-
412405
// Build complete blocks object
413406
const completeBlocks: Record<string, any> = {}
414407
const completeSubBlockValues: Record<string, Record<string, any>> = {}
@@ -443,8 +436,6 @@ export async function importWorkflowFromYaml(
443436
: {}),
444437
...starterBlock.inputs, // Override with YAML values
445438
}
446-
447-
448439
} else {
449440
// Create new starter block
450441
starterBlockId = crypto.randomUUID()
@@ -478,8 +469,6 @@ export async function importWorkflowFromYaml(
478469

479470
// Set starter block values
480471
completeSubBlockValues[starterBlockId] = { ...starterBlock.inputs }
481-
482-
483472
}
484473
}
485474
}
@@ -488,7 +477,6 @@ export async function importWorkflowFromYaml(
488477
let blocksProcessed = 0
489478
for (const block of blocks) {
490479
if (block.type === 'starter') {
491-
492480
continue // Already handled above
493481
}
494482

@@ -549,8 +537,6 @@ export async function importWorkflowFromYaml(
549537
}
550538
}
551539

552-
553-
554540
// Create complete edges using the ID mapping
555541
const completeEdges: any[] = []
556542
for (const edge of edges) {
@@ -563,7 +549,6 @@ export async function importWorkflowFromYaml(
563549
source: sourceId,
564550
target: targetId,
565551
})
566-
567552
} else {
568553
logger.warn(`Skipping edge - missing blocks: ${edge.source} -> ${edge.target}`)
569554
}
@@ -597,7 +582,7 @@ export async function importWorkflowFromYaml(
597582
hasActiveWebhook: false,
598583
}
599584

600-
// Save directly to database via API
585+
// Save directly to database via API
601586
const response = await fetch(`/api/workflows/${activeWorkflowId}/state`, {
602587
method: 'PUT',
603588
headers: {
@@ -622,14 +607,14 @@ export async function importWorkflowFromYaml(
622607
if (!targetWorkflowId) {
623608
useWorkflowStore.setState(completeWorkflowState)
624609

625-
// Set subblock values in local store
610+
// Set subblock values in local store
626611
useSubBlockStore.setState((state: any) => ({
627612
workflowValues: {
628613
...state.workflowValues,
629614
[activeWorkflowId]: completeSubBlockValues,
630615
},
631616
}))
632-
}
617+
}
633618

634619
// Brief delay for UI to update
635620
await new Promise((resolve) => setTimeout(resolve, 100))
@@ -640,8 +625,6 @@ export async function importWorkflowFromYaml(
640625
const totalBlocksCreated =
641626
Object.keys(completeBlocks).length - (existingStarterBlocks.length > 0 ? 1 : 0)
642627

643-
644-
645628
return {
646629
success: true,
647630
errors: [],

0 commit comments

Comments
 (0)