mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Fix partial execution with pinned data on child node run (#4764)
🐛 Fix partial execution with pinned data on child node run
This commit is contained in:
parent
9e7a156532
commit
5d75e6ceb3
|
@ -70,6 +70,11 @@ export class WorkflowsService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the pinned trigger to execute the workflow from, if any.
|
* Find the pinned trigger to execute the workflow from, if any.
|
||||||
|
*
|
||||||
|
* - In a full execution, select the _first_ pinned trigger.
|
||||||
|
* - In a partial execution,
|
||||||
|
* - select the _first_ pinned trigger that leads to the executed node,
|
||||||
|
* - else select the executed pinned trigger.
|
||||||
*/
|
*/
|
||||||
static findPinnedTrigger(workflow: IWorkflowDb, startNodes?: string[], pinData?: IPinData) {
|
static findPinnedTrigger(workflow: IWorkflowDb, startNodes?: string[], pinData?: IPinData) {
|
||||||
if (!pinData || !startNodes) return null;
|
if (!pinData || !startNodes) return null;
|
||||||
|
@ -87,7 +92,22 @@ export class WorkflowsService {
|
||||||
|
|
||||||
const [startNodeName] = startNodes;
|
const [startNodeName] = startNodes;
|
||||||
|
|
||||||
return pinnedTriggers.find((pt) => pt.name === startNodeName) ?? null; // partial execution
|
const parentNames = new Workflow({
|
||||||
|
nodes: workflow.nodes,
|
||||||
|
connections: workflow.connections,
|
||||||
|
active: workflow.active,
|
||||||
|
nodeTypes: NodeTypes(),
|
||||||
|
}).getParentNodes(startNodeName);
|
||||||
|
|
||||||
|
let checkNodeName = '';
|
||||||
|
|
||||||
|
if (parentNames.length === 0) {
|
||||||
|
checkNodeName = startNodeName;
|
||||||
|
} else {
|
||||||
|
checkNodeName = parentNames.find((pn) => pn === pinnedTriggers[0].name) as string;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pinnedTriggers.find((pt) => pt.name === checkNodeName) ?? null; // partial execution
|
||||||
}
|
}
|
||||||
|
|
||||||
static async get(workflow: Partial<WorkflowEntity>, options?: { relations: string[] }) {
|
static async get(workflow: Partial<WorkflowEntity>, options?: { relations: string[] }) {
|
||||||
|
|
Loading…
Reference in a new issue