Skip to content

Commit 17edf04

Browse files
improvement(triggers): uuid, autolayout, copilot context (#1503)
* make trigger select uuid consistent with sidebar selection * add trigger allowed flag for core triggers * fix autolayout with new triggers
1 parent 7946184 commit 17edf04

File tree

7 files changed

+12
-2
lines changed

7 files changed

+12
-2
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ const WorkflowContent = React.memo(() => {
781781

782782
// Create the trigger block at the center of the viewport
783783
const centerPosition = project({ x: window.innerWidth / 2, y: window.innerHeight / 2 })
784-
const id = `${triggerId}_${Date.now()}`
784+
const id = crypto.randomUUID()
785785

786786
// Add the trigger block with trigger mode if specified
787787
addBlock(

apps/sim/blocks/blocks/api_trigger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { BlockConfig } from '@/blocks/types'
33

44
export const ApiTriggerBlock: BlockConfig = {
55
type: 'api_trigger',
6+
triggerAllowed: true,
67
name: 'API',
78
description: 'Expose as HTTP API endpoint',
89
longDescription:

apps/sim/blocks/blocks/chat_trigger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ChatTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(Messag
77

88
export const ChatTriggerBlock: BlockConfig = {
99
type: 'chat_trigger',
10+
triggerAllowed: true,
1011
name: 'Chat',
1112
description: 'Start workflow from a chat deployment',
1213
longDescription: 'Chat trigger to run the workflow via deployed chat interfaces.',

apps/sim/blocks/blocks/input_trigger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const InputTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(FormI
77

88
export const InputTriggerBlock: BlockConfig = {
99
type: 'input_trigger',
10+
triggerAllowed: true,
1011
name: 'Input Form',
1112
description: 'Start workflow manually with a defined input schema',
1213
longDescription:

apps/sim/blocks/blocks/manual_trigger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ManualTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(Play
77

88
export const ManualTriggerBlock: BlockConfig = {
99
type: 'manual_trigger',
10+
triggerAllowed: true,
1011
name: 'Manual',
1112
description: 'Start workflow manually from the editor',
1213
longDescription:

apps/sim/blocks/blocks/schedule.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ScheduleIcon = (props: SVGProps<SVGSVGElement>) => createElement(Clock, pr
77

88
export const ScheduleBlock: BlockConfig = {
99
type: 'schedule',
10+
triggerAllowed: true,
1011
name: 'Schedule',
1112
description: 'Trigger workflow execution on a schedule',
1213
longDescription:

apps/sim/lib/workflows/autolayout/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { TriggerUtils } from '@/lib/workflows/triggers'
12
import type { BlockState } from '@/stores/workflows/workflow/types'
23
import type { BlockDimensions, BoundingBox } from './types'
34

@@ -70,5 +71,9 @@ export function getBlocksByParent(blocks: Record<string, BlockState>): {
7071
}
7172

7273
export function isStarterBlock(block: BlockState): boolean {
73-
return block.type === 'starter' || block.type === 'webhook' || block.type === 'schedule'
74+
if (TriggerUtils.isTriggerBlock({ type: block.type, triggerMode: block.triggerMode })) {
75+
return true
76+
}
77+
78+
return block.triggerMode === true
7479
}

0 commit comments

Comments
 (0)