Skip to content

Commit b191c7a

Browse files
committed
Fix webhook
1 parent b3fa3f3 commit b191c7a

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -852,17 +852,6 @@ export function useCollaborativeWorkflow() {
852852
workflowStore.addEdge(autoConnectEdge)
853853
}
854854

855-
// Explicitly seed the subblock store to ensure values are available
856-
// This ensures the UI can read the initial values immediately
857-
if (activeWorkflowId && blockConfig.subBlocks) {
858-
blockConfig.subBlocks.forEach((subBlock) => {
859-
const subBlockValue = subBlocks[subBlock.id]?.value
860-
if (subBlockValue !== undefined) {
861-
useSubBlockStore.getState().setValue(id, subBlock.id, subBlockValue)
862-
}
863-
})
864-
}
865-
866855
// Record for undo AFTER adding (pass the autoConnectEdge explicitly)
867856
undoRedo.recordAddBlock(id, autoConnectEdge)
868857

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export function getAllTriggerBlocks(): TriggerInfo[] {
124124
icon: block.icon,
125125
color: block.bgColor,
126126
category: 'core',
127+
enableTriggerMode: hasTriggerCapability(block),
127128
})
128129
}
129130
// Check if it's a tool with trigger capability (has trigger-config subblock)
@@ -153,16 +154,20 @@ export function getAllTriggerBlocks(): TriggerInfo[] {
153154
* Check if a block has trigger capability (contains trigger mode subblocks)
154155
*/
155156
export function hasTriggerCapability(block: BlockConfig): boolean {
156-
// Pure trigger blocks (category === 'triggers') should NOT have trigger mode enabled
157-
// They ARE triggers, not blocks that can optionally become triggers
157+
// Check if any subblocks have trigger mode
158+
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
158163
if (block.category === 'triggers') {
159-
return false
164+
return hasTriggerModeSubBlocks
160165
}
161166

162-
// Only non-trigger blocks that have trigger capability should enable trigger mode
167+
// Non-trigger blocks can have trigger capability
163168
return (
164169
(block.triggers?.enabled === true && block.triggers.available.length > 0) ||
165-
block.subBlocks.some((subBlock) => subBlock.mode === 'trigger')
170+
hasTriggerModeSubBlocks
166171
)
167172
}
168173

0 commit comments

Comments
 (0)