diff --git a/packages/editor-ui/src/components/FixedCollectionParameter.vue b/packages/editor-ui/src/components/FixedCollectionParameter.vue index 786c13d28f..6346cc76a9 100644 --- a/packages/editor-ui/src/components/FixedCollectionParameter.vue +++ b/packages/editor-ui/src/components/FixedCollectionParameter.vue @@ -145,7 +145,9 @@ export default mixins(genericHelpers) const newParameterValue: INodeParameters = {}; for (const optionParameter of option.values) { - if (optionParameter.typeOptions !== undefined && optionParameter.typeOptions.multipleValues === true) { + if (optionParameter.type === 'fixedCollection' && optionParameter.typeOptions.multipleValues === true) { + newParameterValue[optionParameter.name] = {}; + } else if (optionParameter.typeOptions !== undefined && optionParameter.typeOptions.multipleValues === true) { // Multiple values are allowed so append option to array newParameterValue[optionParameter.name] = get(this.nodeValues, `${this.path}.${optionParameter.name}`, []); (newParameterValue[optionParameter.name] as INodeParameters[]).push(JSON.parse(JSON.stringify(optionParameter.default))); diff --git a/packages/workflow/test/NodeHelpers.test.ts b/packages/workflow/test/NodeHelpers.test.ts index e8938dab79..207a06e626 100644 --- a/packages/workflow/test/NodeHelpers.test.ts +++ b/packages/workflow/test/NodeHelpers.test.ts @@ -2676,6 +2676,144 @@ describe('Workflow', () => { }, }, }, + { + description: 'complex type "fixedCollection" with "multipleValues: true". Which contains complex type "fixedCollection" with "multipleValues: true". One value set.', + input: { + nodePropertiesArray: [ + { + displayName: 'Values1', + name: 'values1', + type: 'fixedCollection', + typeOptions: { + multipleValues: true, + }, + description: 'The value to set.', + default: {}, + options: [ + { + displayName: 'Options1', + name: 'options1', + values: [ + { + displayName: 'Values2', + name: 'values2', + type: 'fixedCollection', + typeOptions: { + multipleValues: true, + }, + description: 'The value to set.', + default: {}, + options: [ + { + displayName: 'Options2', + name: 'options2', + values: [ + { + name: 'string1', + displayName: 'string1', + type: 'string', + default: 'default string1', + }, + { + name: 'number1', + displayName: 'number1', + type: 'number', + default: 0, + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + nodeValues: { + values1: { + options1: [ + { + values2: { + options2: [ + { + number1: 1, + }, + ], + }, + }, + ], + }, + }, + }, + output: { + noneDisplayedFalse: { + defaultsFalse: { + values1: { + options1: [ + { + values2: { + options2: [ + { + number1: 1, + }, + ], + }, + }, + ], + }, + }, + defaultsTrue: { + values1: { + options1: [ + { + values2: { + options2: [ + { + string1: 'default string1', + number1: 1, + }, + ], + }, + }, + ], + }, + }, + }, + noneDisplayedTrue: { + defaultsFalse: { + values1: { + options1: [ + { + values2: { + options2: [ + { + number1: 1, + }, + ], + }, + }, + ], + }, + }, + defaultsTrue: { + values1: { + options1: [ + { + values2: { + options2: [ + { + string1: 'default string1', + number1: 1, + }, + ], + }, + }, + ], + }, + }, + }, + }, + }, ];