mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -08:00
fix(HubSpot Node): Fetching available parameters fails when using expressions (#7672)
This fix affects all nodes, will fix this issue in all nodes Github issue / Community forum post (link here to close automatically): Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
1c7225ebdb
commit
a9ab73896e
|
@ -538,7 +538,7 @@ export function getParameterResolveOrder(
|
||||||
*/
|
*/
|
||||||
export function getNodeParameters(
|
export function getNodeParameters(
|
||||||
nodePropertiesArray: INodeProperties[],
|
nodePropertiesArray: INodeProperties[],
|
||||||
nodeValues: INodeParameters,
|
nodeValues: INodeParameters | null,
|
||||||
returnDefaults: boolean,
|
returnDefaults: boolean,
|
||||||
returnNoneDisplayed: boolean,
|
returnNoneDisplayed: boolean,
|
||||||
node: INode | null,
|
node: INode | null,
|
||||||
|
@ -588,16 +588,17 @@ export function getNodeParameters(
|
||||||
nodeValuesRoot = nodeValuesRoot || nodeValuesDisplayCheck;
|
nodeValuesRoot = nodeValuesRoot || nodeValuesDisplayCheck;
|
||||||
|
|
||||||
// Go through the parameters in order of their dependencies
|
// Go through the parameters in order of their dependencies
|
||||||
const parameterItterationOrderIndex = getParameterResolveOrder(
|
const parameterIterationOrderIndex = getParameterResolveOrder(
|
||||||
nodePropertiesArray,
|
nodePropertiesArray,
|
||||||
parameterDependencies,
|
parameterDependencies,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const parameterIndex of parameterItterationOrderIndex) {
|
for (const parameterIndex of parameterIterationOrderIndex) {
|
||||||
const nodeProperties = nodePropertiesArray[parameterIndex];
|
const nodeProperties = nodePropertiesArray[parameterIndex];
|
||||||
if (
|
if (
|
||||||
nodeValues[nodeProperties.name] === undefined &&
|
!nodeValues ||
|
||||||
(!returnDefaults || parentType === 'collection')
|
(nodeValues[nodeProperties.name] === undefined &&
|
||||||
|
(!returnDefaults || parentType === 'collection'))
|
||||||
) {
|
) {
|
||||||
// The value is not defined so go to the next
|
// The value is not defined so go to the next
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2,12 +2,12 @@ import type { INodeParameters, INodeProperties } from '@/Interfaces';
|
||||||
import { getNodeParameters } from '@/NodeHelpers';
|
import { getNodeParameters } from '@/NodeHelpers';
|
||||||
|
|
||||||
describe('NodeHelpers', () => {
|
describe('NodeHelpers', () => {
|
||||||
describe('getParameterValue', () => {
|
describe('getNodeParameters', () => {
|
||||||
const tests: Array<{
|
const tests: Array<{
|
||||||
description: string;
|
description: string;
|
||||||
input: {
|
input: {
|
||||||
nodePropertiesArray: INodeProperties[];
|
nodePropertiesArray: INodeProperties[];
|
||||||
nodeValues: INodeParameters;
|
nodeValues: INodeParameters | null;
|
||||||
};
|
};
|
||||||
output: {
|
output: {
|
||||||
noneDisplayedFalse: {
|
noneDisplayedFalse: {
|
||||||
|
@ -3336,6 +3336,61 @@ describe('NodeHelpers', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: 'nodeValues is null (for example when resolving expression fails)',
|
||||||
|
input: {
|
||||||
|
nodePropertiesArray: [
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customPropertiesUi',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'customPropertiesValues',
|
||||||
|
displayName: 'Custom Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name or ID',
|
||||||
|
name: 'property',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getDealCustomProperties',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description:
|
||||||
|
'Name of the property. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
description: 'Value of the property',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
nodeValues: null,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
noneDisplayedFalse: {
|
||||||
|
defaultsFalse: {},
|
||||||
|
defaultsTrue: {},
|
||||||
|
},
|
||||||
|
noneDisplayedTrue: {
|
||||||
|
defaultsFalse: {},
|
||||||
|
defaultsTrue: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const testData of tests) {
|
for (const testData of tests) {
|
||||||
|
|
Loading…
Reference in a new issue