mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(editor): Fix breaking Drop-downs after removing expressions (#3094)
* 🐛 Fixed multiOption parameter input dropdown values after removing expression. * ♻️ Moved array value normalization to removeExpression action. * 🐛 Handled scenario where expression contained invalid value.
This commit is contained in:
parent
47bbe9857b
commit
17b0cd8f76
|
@ -421,7 +421,7 @@ export default mixins(
|
|||
|
||||
return false;
|
||||
},
|
||||
expressionValueComputed (): NodeParameterValue | null {
|
||||
expressionValueComputed (): NodeParameterValue | string[] | null {
|
||||
if (this.areExpressionsDisabled) {
|
||||
return this.value;
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ export default mixins(
|
|||
|
||||
this.$emit('textInput', parameterData);
|
||||
},
|
||||
valueChanged (value: string | number | boolean | Date | null) {
|
||||
valueChanged (value: string[] | string | number | boolean | Date | null) {
|
||||
if (value instanceof Date) {
|
||||
value = value.toISOString();
|
||||
}
|
||||
|
@ -768,7 +768,14 @@ export default mixins(
|
|||
this.expressionEditDialogVisible = true;
|
||||
this.trackExpressionEditOpen();
|
||||
} else if (command === 'removeExpression') {
|
||||
this.valueChanged(this.expressionValueComputed !== undefined ? this.expressionValueComputed : null);
|
||||
let value = this.expressionValueComputed;
|
||||
|
||||
if (this.parameter.type === 'multiOptions' && typeof value === 'string') {
|
||||
value = (value || '').split(',')
|
||||
.filter((value) => (this.parameterOptions || []).find((option) => option.value === value));
|
||||
}
|
||||
|
||||
this.valueChanged(typeof value !== 'undefined' ? value : null);
|
||||
} else if (command === 'refreshOptions') {
|
||||
this.loadRemoteParameterOptions();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue