fix: Open form popup for Form Trigger even if it has execution data (#19416)

This commit is contained in:
Michael Kret
2025-09-15 17:04:18 +03:00
committed by GitHub
parent 752260784c
commit 1c45d8ba2e
2 changed files with 66 additions and 2 deletions

View File

@@ -113,6 +113,69 @@ describe('displayForm', () => {
expect(windowOpenSpy).not.toHaveBeenCalled();
});
it('should not call openPopUpWindow if node has run data and is not a form trigger node', async () => {
const nodes: INode[] = [
{
id: '1',
name: 'RegularNode',
typeVersion: 1,
type: 'n8n-nodes-base.httpRequest',
position: [0, 0],
parameters: {},
},
];
const runData: IRunData = { RegularNode: [] };
const pinData: IPinData = {};
fetchMock.mockResolvedValue(successResponse);
await displayForm({
nodes,
runData,
pinData,
destinationNode: undefined,
triggerNode: undefined,
directParentNodes: [],
source: undefined,
getTestUrl: getTestUrlMock,
});
expect(windowOpenSpy).not.toHaveBeenCalled();
});
it('should call openPopUpWindow for form trigger node even if it has run data', async () => {
const nodes: INode[] = [
{
id: '1',
name: 'FormTrigger',
typeVersion: 1,
type: FORM_TRIGGER_NODE_TYPE,
position: [0, 0],
parameters: {},
},
];
const runData: IRunData = { FormTrigger: [] };
const pinData: IPinData = {};
getTestUrlMock.mockReturnValue('http://test-url.com');
fetchMock.mockResolvedValue(successResponse);
await displayForm({
nodes,
runData,
pinData,
destinationNode: undefined,
triggerNode: undefined,
directParentNodes: [],
source: undefined,
getTestUrl: getTestUrlMock,
});
expect(windowOpenSpy).toHaveBeenCalled();
});
it('should skip nodes if destinationNode does not match and node is not a directParentNode', async () => {
const nodes: INode[] = [
{

View File

@@ -147,9 +147,10 @@ export async function displayForm({
for (const node of nodes) {
if (triggerNode !== undefined && triggerNode !== node.name) continue;
const hasNodeRun = runData?.hasOwnProperty(node.name);
const hasNodeRunAndIsNotFormTrigger =
runData?.hasOwnProperty(node.name) && node.type !== FORM_TRIGGER_NODE_TYPE;
if (hasNodeRun || pinData[node.name]) continue;
if (hasNodeRunAndIsNotFormTrigger || pinData[node.name]) continue;
if (![FORM_TRIGGER_NODE_TYPE].includes(node.type)) continue;