Skip to content

Commit

Permalink
fix(editor): Fix typing $ in inline expression field reloading node…
Browse files Browse the repository at this point in the history
… parameters form (#6374)

* fix(editor): Fix typing `$` in inline expression field reloading node parameters form
* ⚡ Setting resource mapper empty field values to empty strings
  • Loading branch information
MiloradFilipovic authored and krynble committed Jun 5, 2023
1 parent bb66093 commit 5f62e27
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/ParameterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ export default defineComponent({
};
},
watch: {
dependentParametersValues() {
async dependentParametersValues() {
// Reload the remote parameters whenever a parameter
// on which the current field depends on changes
void this.loadRemoteParameterOptions();
await this.loadRemoteParameterOptions();
},
value() {
if (this.parameter.type === 'color' && this.getArgument('showAlpha') === true) {
Expand Down
9 changes: 7 additions & 2 deletions packages/editor-ui/src/components/ParameterInputList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@
import { defineComponent } from 'vue';
import type { PropType } from 'vue';
import { mapStores } from 'pinia';
import type { INodeParameters, INodeProperties, NodeParameterValue } from 'n8n-workflow';
import type {
INodeParameters,
INodeProperties,
INodeTypeDescription,
NodeParameterValue,
} from 'n8n-workflow';
import { deepCopy } from 'n8n-workflow';
import type { INodeUi, IUpdateInformation } from '@/Interface';
Expand Down Expand Up @@ -224,7 +229,7 @@ export default defineComponent({
return index < this.filteredParameters.length ? index : this.filteredParameters.length - 1;
},
mainNodeAuthField(): INodeProperties | null {
return getMainAuthField(this.nodeType || undefined);
return getMainAuthField(this.nodeType || null);
},
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,15 @@ export default defineComponent({
this.$emit('input', { ...this.value, __regex: mode.extractValue.regex });
}
},
dependentParametersValues() {
dependentParametersValues(currentValue, oldValue) {
const isUpdated = oldValue !== null && currentValue !== null && oldValue !== currentValue;
// Reset value if dependent parameters change
if (this.value && isResourceLocatorValue(this.value) && this.value.value !== '') {
if (
isUpdated &&
this.value &&
isResourceLocatorValue(this.value) &&
this.value.value !== ''
) {
this.$emit('input', {
...this.value,
cachedResultName: '',
Expand Down

0 comments on commit 5f62e27

Please sign in to comment.