refactor(editor): Refine INodeUpdatePropertiesInformation type and remove unnecessary type assertions (#17783)

This commit is contained in:
Suguru Inoue
2025-07-29 12:39:03 +02:00
committed by GitHub
parent 056302ebe5
commit 04c1121075
7 changed files with 10 additions and 30 deletions

View File

@@ -160,10 +160,7 @@ export interface IUpdateInformation<T extends NodeParameterValueType = NodeParam
export interface INodeUpdatePropertiesInformation {
name: string; // Node-Name
properties: {
position: XYPosition;
[key: string]: IDataObject | XYPosition;
};
properties: Partial<INodeUi>;
}
export type XYPosition = [number, number];

View File

@@ -295,7 +295,6 @@ function clearSelectedCredential(credentialType: string) {
name: props.node.name,
properties: {
credentials,
position: props.node.position,
},
};
@@ -412,7 +411,6 @@ function onCredentialSelected(
name: props.node.name,
properties: {
credentials,
position: props.node.position,
},
};

View File

@@ -24,13 +24,7 @@ import {
} from 'n8n-workflow';
import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, ref, toRef, watch } from 'vue';
import type {
INodeUi,
INodeUpdatePropertiesInformation,
IRunDataDisplayMode,
ITab,
NodePanelType,
} from '@/Interface';
import type { INodeUi, IRunDataDisplayMode, ITab, NodePanelType } from '@/Interface';
import {
CORE_NODES_CATEGORY,
@@ -1311,8 +1305,8 @@ function enableNode() {
name: node.value.name,
properties: {
disabled: !node.value.disabled,
} as IDataObject,
} as INodeUpdatePropertiesInformation;
},
};
workflowsStore.updateNodeProperties(updateInformation);
}

View File

@@ -5,7 +5,6 @@ import set from 'lodash/set';
import unset from 'lodash/unset';
import type {
IDataObject,
NodeParameterValue,
MessageEventBusDestinationOptions,
INodeParameters,
@@ -252,7 +251,7 @@ function valueChanged(parameterData: IUpdateInformation) {
nodeParameters.value = deepCopy(nodeParametersCopy);
workflowsStore.updateNodeProperties({
name: node.value.name,
properties: { parameters: nodeParameters.value as unknown as IDataObject, position: [0, 0] },
properties: { parameters: nodeParameters.value, position: [0, 0] },
});
if (hasOnceBeenSaved.value) {
logStreamingStore.updateDestination(nodeParameters.value);

View File

@@ -66,7 +66,6 @@ export const useSetupWorkflowCredentialsModalState = () => {
workflowsStore.updateNodeProperties({
name: node.name,
properties: {
position: node.position,
credentials: {
...node.credentials,
[usages.credentialType]: credential,
@@ -101,7 +100,6 @@ export const useSetupWorkflowCredentialsModalState = () => {
workflowsStore.updateNodeProperties({
name: node.name,
properties: {
position: node.position,
credentials,
},
});

View File

@@ -20,7 +20,6 @@ import type {
ITaskDataConnections,
IRunData,
IBinaryKeyData,
IDataObject,
INode,
INodePropertyOptions,
INodeCredentialsDetails,
@@ -722,8 +721,8 @@ export function useNodeHelpers() {
name: node.name,
properties: {
disabled: newDisabledState,
} as IDataObject,
} as INodeUpdatePropertiesInformation;
},
};
telemetry.track('User set node enabled status', {
node_type: node.type,

View File

@@ -1,9 +1,4 @@
import type {
AppliedThemeOption,
INodeUi,
INodeUpdatePropertiesInformation,
NodeAuthenticationOption,
} from '@/Interface';
import type { AppliedThemeOption, INodeUi, NodeAuthenticationOption } from '@/Interface';
import type { ITemplatesNode } from '@n8n/rest-api-client/api/templates';
import {
CORE_NODES_CATEGORY,
@@ -386,8 +381,8 @@ export const updateNodeAuthType = (node: INodeUi | null, type: string) => {
...node.parameters,
[nodeAuthField.name]: type,
},
} as IDataObject,
} as INodeUpdatePropertiesInformation;
},
};
useWorkflowsStore().updateNodeProperties(updateInformation);
}
}