fix(n8n Form Node): Completion page display if EXECUTIONS_DATA_SAVE_ON_SUCCESS=none (#11869)

This commit is contained in:
Michael Kret
2024-12-11 13:52:40 +02:00
committed by GitHub
parent ec54333f78
commit f4c2523419
7 changed files with 38 additions and 7 deletions

View File

@@ -267,7 +267,7 @@ export class Form extends Node {
const method = context.getRequestObject().method;
if (operation === 'completion') {
if (operation === 'completion' && method === 'GET') {
const staticData = context.getWorkflowStaticData('node');
const id = `${context.getExecutionId()}-${context.getNode().name}`;
const config = staticData?.[id] as CompletionPageConfig;
@@ -300,6 +300,12 @@ export class Form extends Node {
return { noWebhookResponse: true };
}
if (operation === 'completion' && method === 'POST') {
return {
workflowData: [context.evaluateExpression('{{ $input.all() }}') as INodeExecutionData[]],
};
}
if (method === 'GET') {
const options = context.getNodeParameter('options', {}) as {
formTitle: string;
@@ -336,7 +342,7 @@ export class Form extends Node {
const connectedNodes = context.getChildNodes(context.getNode().name);
const hasNextPage = connectedNodes.some(
(node) => node.type === FORM_NODE_TYPE || node.type === WAIT_NODE_TYPE,
(node) => !node.disabled && (node.type === FORM_NODE_TYPE || node.type === WAIT_NODE_TYPE),
);
if (hasNextPage) {
@@ -426,6 +432,9 @@ export class Form extends Node {
};
staticData[id] = config;
const waitTill = new Date(WAIT_INDEFINITELY);
await context.putExecutionToWait(waitTill);
}
return [context.getInputData()];