Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix typing $ in inline expression field reloading node parameters form #6374

Merged
merged 2 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -514,10 +514,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 @@ -129,7 +129,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 @@ -236,7 +241,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
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ function getFieldDescription(field: ResourceMapperField): string {
return '';
}

function getParameterValue(parameterName: string) {
function getParameterValue(parameterName: string): string | number | boolean | null {
const fieldName = parseResourceMapperFieldName(parameterName);
if (fieldName && props.paramValue.value) {
return props.paramValue.value[fieldName];
return props.paramValue.value[fieldName] || '';
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import { fieldCannotBeDeleted, isResourceMapperValue, parseResourceMapperFieldNa
import { i18n as locale } from '@/plugins/i18n';
import { useNDVStore } from '@/stores/ndv.store';

interface Props {
type Props = {
parameter: INodeProperties;
node: INode | null;
path: string;
inputSize: string;
labelSize: string;
dependentParametersValues: string | null;
}
dependentParametersValues?: string | null;
};

const nodeTypesStore = useNodeTypesStore();
const ndvStore = useNDVStore();
Expand Down