Commit 43ca4b2
authored
refactor(frontend): avoid redundant validateOperator call in applyOperatorBorder (#5702)
### What changes were proposed in this PR?
WorkflowEditorComponent.applyOperatorBorder(operatorID)` always
recomputes validation as its first step:
```typescript
const validation = this.validationWorkflowService.validateOperator(operatorID);
```
This is redundant when the helper is called from the validation-stream
subscriber in handleOperatorValidation, the stream's emitted event
already carries the Validation result that was just computed by
updateValidationState.
This PR:
- Adds an optional validation?: Validation parameter to
applyOperatorBorder. The helper uses it when provided, and falls back to
validateOperator(operatorID) otherwise.
- Updates handleOperatorValidation to pass value.validation from the
stream into the helper.
- Leaves the operator-add stream subscriber unchanged and hence it
doesn't have a Validation in hand at that point, so it correctly falls
through to the lazy-fetch path.
- Functionally identical (the stream emits the same Validation that
would have been recomputed), purely avoids the duplicate call.
Originally flagged as an optional nit during the PR #5146 review.
Attempted in PR #5626 but split out as per the reviewer's request so
that PR could stay scoped to test restructuring; this PR completes the
follow-up.
### Any related issues, documentation, discussions?
Closes #5683
Related: PR #5146 (where the nit was raised), PR #5626 (where this was
attempted and split out).
### How was this PR tested?
Added one focused unit test in `workflow-editor.component.spec.ts`
inside the existing `operator border restoration after navigation`
describe block: `it("uses the Validation passed in instead of
recomputing it", ...)`. The test clears the `validateOperator` spy after
the operator-add validation chain settles, then calls
`applyOperatorBorder` directly with a `Validation` argument and asserts
`validateOperator` is not called.
Verified locally:
- `tsc --noEmit`: clean
- `eslint`: clean
- `ng test` (jsdom): 26/26 pass in the editor spec (was 25, new test
adds one)
- `ng run gui:test-browser`: 13/13 pass
### Was this PR authored or co-authored using generative AI tooling?
This PR was co-authored using Claude Code (Anthropic Claude Opus 4.7)1 parent d4eb9f7 commit 43ca4b2
2 files changed
Lines changed: 37 additions & 5 deletions
File tree
- frontend/src/app/workspace/component/workflow-editor
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
913 | 941 | | |
914 | 942 | | |
915 | 943 | | |
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | | - | |
402 | | - | |
403 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
404 | 408 | | |
405 | 409 | | |
406 | 410 | | |
| |||
1025 | 1029 | | |
1026 | 1030 | | |
1027 | 1031 | | |
1028 | | - | |
| 1032 | + | |
1029 | 1033 | | |
1030 | 1034 | | |
1031 | 1035 | | |
| |||
0 commit comments