diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index cfcdd23cfb..0be3685f6f 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -2874,19 +2874,11 @@ function isOAuth(credType: ICredentialType) { ); } -const TRIGGER_NODE_SUFFIXES = ['trigger', 'webhook']; - -const isTrigger = (str: string) => - TRIGGER_NODE_SUFFIXES.some((suffix) => str.toLowerCase().includes(suffix)); +const isTrigger = (nodeType: string) => + ['trigger', 'webhook'].some((suffix) => nodeType.toLowerCase().includes(suffix)); function findFirstPinnedTrigger(workflow: IWorkflowDb, pinData?: IPinData) { if (!pinData) return; - const firstPinnedTriggerName = Object.keys(pinData).find(isTrigger); - - if (!firstPinnedTriggerName) return; - - return workflow.nodes.find( - ({ type, name }) => isTrigger(type) && name === firstPinnedTriggerName, - ); + return workflow.nodes.find((node) => isTrigger(node.type) && pinData[node.name]); }