Skip to content

Reuse validation result from the validation stream in applyOperatorBorder #5683

@PG1204

Description

@PG1204

Task Summary

Avoid redundant validateOperator() recomputation in applyOperatorBorder by accepting the Validation from the validation stream.

Context

WorkflowEditorComponent.applyOperatorBorder(operatorID) recomputes validation as its first step:

const validation = this.validationWorkflowService.validateOperator(operatorID);

When called from the validation-stream subscriber in handleOperatorValidation, this is redundant, the stream's emitted event already carries the Validation result that was just computed in updateValidationState.

Originally flagged as an optional nit during the PR #5146 review. Attempted in PR #5626 but split out per reviewer request so that PR could stay scoped to test restructuring.

Proposed change

In frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:

  • Add an optional validation?: Validation parameter to applyOperatorBorder; use it when provided, fall back to validateOperator(operatorID) otherwise.
  • In handleOperatorValidation, pass value.validation from the stream into the helper.
  • Operator-add subscription stays unchanged (no Validation in hand -> falls through to the lazy fetch).

Required test

Add a focused test in workflow-editor.component.spec.ts that asserts validateOperator is not called when a Validation argument is passed in.

Related

Issue #5318 / PR #5626 (where this was attempted and split out)

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions