Bugfix/Concatenate overrideconfig array (#4720)

concatenate overrideconfig array
This commit is contained in:
Henry Heng 2025-06-24 21:59:56 +01:00 committed by GitHub
parent 3f26569e6e
commit d5bc718246
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 36 additions and 18 deletions

View File

@ -1135,8 +1135,14 @@ export const replaceInputsWithConfig = (
} else if (Array.isArray(overrideConfig[config])) { } else if (Array.isArray(overrideConfig[config])) {
// Handle arrays as direct parameter values // Handle arrays as direct parameter values
if (isParameterEnabled(flowNodeData.label, config)) { if (isParameterEnabled(flowNodeData.label, config)) {
// If existing value is also an array, concatenate; otherwise replace
const existingValue = inputsObj[config]
if (Array.isArray(existingValue)) {
inputsObj[config] = [...new Set([...existingValue, ...overrideConfig[config]])]
} else {
inputsObj[config] = overrideConfig[config] inputsObj[config] = overrideConfig[config]
} }
}
continue continue
} else if (overrideConfig[config] && typeof overrideConfig[config] === 'object') { } else if (overrideConfig[config] && typeof overrideConfig[config] === 'object') {
const nodeIds = Object.keys(overrideConfig[config]) const nodeIds = Object.keys(overrideConfig[config])
@ -1168,6 +1174,12 @@ export const replaceInputsWithConfig = (
const overrideConfigValue = overrideConfig[config] const overrideConfigValue = overrideConfig[config]
if (overrideConfigValue) { if (overrideConfigValue) {
if (typeof overrideConfigValue === 'object') { if (typeof overrideConfigValue === 'object') {
// Handle arrays specifically - concatenate instead of replace
if (Array.isArray(overrideConfigValue) && Array.isArray(paramValue)) {
paramValue = [...new Set([...paramValue, ...overrideConfigValue])]
} else if (Array.isArray(overrideConfigValue)) {
paramValue = overrideConfigValue
} else {
switch (typeof paramValue) { switch (typeof paramValue) {
case 'string': case 'string':
if (paramValue.startsWith('{') && paramValue.endsWith('}')) { if (paramValue.startsWith('{') && paramValue.endsWith('}')) {
@ -1181,12 +1193,18 @@ export const replaceInputsWithConfig = (
paramValue = overrideConfigValue paramValue = overrideConfigValue
break break
case 'object': case 'object':
// Make sure we're not dealing with arrays here
if (!Array.isArray(paramValue)) {
paramValue = Object.assign({}, paramValue, overrideConfigValue) paramValue = Object.assign({}, paramValue, overrideConfigValue)
} else {
paramValue = overrideConfigValue
}
break break
default: default:
paramValue = overrideConfigValue paramValue = overrideConfigValue
break break
} }
}
} else { } else {
paramValue = overrideConfigValue paramValue = overrideConfigValue
} }