fix: Fix lag when node parameters are updated (#6941)

fix: Fix lag when node parameteres are updated
This commit is contained in:
Mutasem Aldmour 2023-08-16 13:33:48 +02:00 committed by GitHub
parent fde6ad1e7f
commit 3eb65e08c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 6 deletions

View file

@ -248,7 +248,7 @@ export default defineComponent({
return '';
},
nodeTypeDescription(): string {
if (this.nodeType && this.nodeType.description) {
if (this.nodeType?.description) {
const shortNodeType = this.$locale.shortNodeType(this.nodeType.name);
return this.$locale.headerText({
@ -551,7 +551,7 @@ export default defineComponent({
const { [lastNamePart]: removedNodeValue, ...remainingNodeValues } = tempValue;
tempValue = remainingNodeValues;
if (isArray === true && (tempValue as INodeParameters[]).length === 0) {
if (isArray && (tempValue as INodeParameters[]).length === 0) {
// If a value from an array got delete and no values are left
// delete also the parent
lastNamePart = nameParts.pop();
@ -717,8 +717,8 @@ export default defineComponent({
this.workflowsStore.setNodeParameters(updateInformation);
this.updateNodeParameterIssues(node, nodeType);
this.updateNodeCredentialIssues(node);
this.updateNodeParameterIssuesByName(node.name);
this.updateNodeCredentialIssuesByName(node.name);
}
} else if (parameterData.name.startsWith('parameters.')) {
// A node parameter changed
@ -800,8 +800,8 @@ export default defineComponent({
oldNodeParameters,
});
this.updateNodeParameterIssues(node, nodeType);
this.updateNodeCredentialIssues(node);
this.updateNodeParameterIssuesByName(node.name);
this.updateNodeCredentialIssuesByName(node.name);
this.$telemetry.trackNodeParametersValuesChange(nodeType.name, parameterData);
} else {
// A property on the node itself changed

View file

@ -181,6 +181,14 @@ export const nodeHelpers = defineComponent({
}
},
updateNodeCredentialIssuesByName(name: string): void {
const node = this.workflowsStore.getNodeByName(name);
if (node) {
this.updateNodeCredentialIssues(node);
}
},
// Updates the credential-issues of the node
updateNodeCredentialIssues(node: INodeUi): void {
const fullNodeIssues: INodeIssues | null = this.getNodeCredentialIssues(node);
@ -197,6 +205,14 @@ export const nodeHelpers = defineComponent({
});
},
updateNodeParameterIssuesByName(name: string): void {
const node = this.workflowsStore.getNodeByName(name);
if (node) {
this.updateNodeParameterIssues(node);
}
},
// Updates the parameter-issues of the node
updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription): void {
if (nodeType === undefined) {