Skip to content

Commit 5b1c422

Browse files
committed
Remove comments
1 parent b191c7a commit 5b1c422

4 files changed

Lines changed: 6 additions & 21 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,10 @@ export function useCollaborativeWorkflow() {
762762
// Generate subBlocks and outputs from the block configuration
763763
const subBlocks: Record<string, any> = {}
764764

765-
// Create subBlocks from the block configuration
766765
if (blockConfig.subBlocks) {
767766
blockConfig.subBlocks.forEach((subBlock) => {
768-
// Resolve initial value using the same logic as the store
769767
let initialValue: unknown = null
770-
771-
// Handle function-based values
768+
772769
if (typeof subBlock.value === 'function') {
773770
try {
774771
initialValue = subBlock.value({})
@@ -781,7 +778,6 @@ export function useCollaborativeWorkflow() {
781778
} else if (subBlock.defaultValue !== undefined) {
782779
initialValue = subBlock.defaultValue
783780
} else if (subBlock.type === 'input-format') {
784-
// Initialize with a default field structure instead of empty array
785781
initialValue = [
786782
{
787783
id: crypto.randomUUID(),
@@ -792,10 +788,9 @@ export function useCollaborativeWorkflow() {
792788
},
793789
]
794790
} else if (subBlock.type === 'table') {
795-
// Special handling for table types
796791
initialValue = []
797792
}
798-
793+
799794
subBlocks[subBlock.id] = {
800795
id: subBlock.id,
801796
type: subBlock.type,

apps/sim/lib/workflows/defaults.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ function resolveInitialValue(subBlock: SubBlockConfig): unknown {
3737
return cloneDefaultValue(subBlock.defaultValue)
3838
}
3939

40-
// Ensure structured fields are initialized properly
4140
if (subBlock.type === 'input-format') {
42-
// Initialize with a default field structure instead of empty array
4341
return [
4442
{
4543
id: crypto.randomUUID(),

apps/sim/lib/workflows/trigger-utils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,12 @@ export function getAllTriggerBlocks(): TriggerInfo[] {
154154
* Check if a block has trigger capability (contains trigger mode subblocks)
155155
*/
156156
export function hasTriggerCapability(block: BlockConfig): boolean {
157-
// Check if any subblocks have trigger mode
158157
const hasTriggerModeSubBlocks = block.subBlocks.some((subBlock) => subBlock.mode === 'trigger')
159-
160-
// If this is a pure trigger block (category === 'triggers'), only enable trigger mode
161-
// if it has subblocks with mode: 'trigger' (e.g., webhook, schedule)
162-
// Pure input triggers like start_trigger don't have trigger mode subblocks
158+
163159
if (block.category === 'triggers') {
164160
return hasTriggerModeSubBlocks
165161
}
166-
167-
// Non-trigger blocks can have trigger capability
162+
168163
return (
169164
(block.triggers?.enabled === true && block.triggers.available.length > 0) ||
170165
hasTriggerModeSubBlocks

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ function resolveInitialSubblockValue(config: SubBlockConfig): unknown {
7070
}
7171

7272
if (config.type === 'input-format') {
73-
// Initialize with a default field structure instead of empty array
7473
return [
7574
{
7675
id: crypto.randomUUID(),
@@ -189,12 +188,10 @@ export const useWorkflowStore = create<WorkflowStore>()(
189188
value: normalizedValue as SubBlockState['value'],
190189
}
191190

192-
// Always initialize the subblock store value, even if it's null or empty array
193-
// This ensures the editor panel can read the value correctly
194191
if (activeWorkflowId) {
195192
try {
196-
// Use the initial value if available, otherwise use null
197-
const valueToStore = initialValue !== undefined ? cloneInitialSubblockValue(initialValue) : null
193+
const valueToStore =
194+
initialValue !== undefined ? cloneInitialSubblockValue(initialValue) : null
198195
subBlockStore.setValue(id, subBlockId, valueToStore)
199196
} catch (error) {
200197
logger.warn('Failed to seed sub-block store value during block creation', {

0 commit comments

Comments
 (0)