mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Fix issue with fixedCollection having all default values
This commit is contained in:
@@ -720,6 +720,18 @@ export function getNodeParameters(
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!returnDefaults &&
|
||||
nodeProperties.typeOptions?.multipleValues === false &&
|
||||
propertyValues &&
|
||||
Object.keys(propertyValues).length === 0
|
||||
) {
|
||||
// For fixedCollections, which only allow one value, it is important to still return
|
||||
// the empty object which indicates that a value got added, even if it does not have
|
||||
// anything set. If that is not done, the value would get lost.
|
||||
return nodeValues;
|
||||
}
|
||||
|
||||
// Iterate over all collections
|
||||
for (const itemName of Object.keys(propertyValues || {})) {
|
||||
if (
|
||||
@@ -795,6 +807,25 @@ export function getNodeParameters(
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!returnDefaults &&
|
||||
nodeProperties.typeOptions?.multipleValues === false &&
|
||||
collectionValues &&
|
||||
Object.keys(collectionValues).length === 0 &&
|
||||
propertyValues &&
|
||||
propertyValues?.constructor.name === 'Object' &&
|
||||
Object.keys(propertyValues).length !== 0
|
||||
) {
|
||||
// For fixedCollections, which only allow one value, it is important to still return
|
||||
// the object with an empty collection property which indicates that a value got added
|
||||
// which contains all default values. If that is not done, the value would get lost.
|
||||
const returnValue = {} as INodeParameters;
|
||||
Object.keys(propertyValues || {}).forEach((value) => {
|
||||
returnValue[value] = {};
|
||||
});
|
||||
return { [nodeProperties.name]: returnValue };
|
||||
}
|
||||
|
||||
if (Object.keys(collectionValues).length !== 0 || returnDefaults) {
|
||||
// Set only if value got found
|
||||
if (returnDefaults) {
|
||||
|
||||
Reference in New Issue
Block a user