refactor(frontend): make redundant operator border repaints a no-op#6927
Open
PG1204 wants to merge 4 commits into
Open
refactor(frontend): make redundant operator border repaints a no-op#6927PG1204 wants to merge 4 commits into
PG1204 wants to merge 4 commits into
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Contributor
Author
|
/request-review @Xiao-zhen-Liu |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6927 +/- ##
=========================================
Coverage 78.95% 78.95%
Complexity 3795 3795
=========================================
Files 1161 1161
Lines 46084 46087 +3
Branches 5110 5111 +1
=========================================
+ Hits 36384 36387 +3
Misses 8077 8077
Partials 1623 1623
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
When an operator is added, its border was painted by two paths - the operator-add restore and the validation pass, producing the same color. Harmless, but a redundant repaint.
This PR adds a guarded border setter (
paintOperatorBorder) inJointUIServicethat writesrect.body/strokeonly when the color actually changes. BothchangeOperatorColorandchangeOperatorStateroute their border write through it, so a repaint with the color the border already has becomes a no-op, effectively "painted once" - including on the navigation-return (reload) path.Deviation from the approach suggested on the issue: the issue suggested dropping the
applyOperatorBordercall from the operator-add handler and letting the validation pass set the border. I kept that call and used the guard instead, becausechangeOperatorStatisticsalready paints the border viachangeOperatorStatewithout checking validity. DroppingapplyOperatorBorderwould make an invalid operator with a cached "completed" status rely on the validation pass firing afterward to correct green→red, reintroducing the order-dependent border fragility that #5146 removed (and it would break in the edge case wheresetDynamicSchemaskips its emit because the schema is unchanged). The guard reaches the same no-redundant-repaint goal while keeping the border validity-correct regardless of event timing.Any related issues, documentation, discussions?
Closes #5726
How was this PR tested?
Unit tests:
JointUIService: the guarded setter skips the write when the border is already the requested color, and writes when it differs.WorkflowEditorComponent: added a navigation-return test for a cached Running operator (orange), alongside the existing completed (green), default (gray), invalid (red), and invalid-over-cached-priority cases.Manual (navigated away from a running workflow and back), border restored correctly for:
Was this PR authored or co-authored using generative AI tooling?
This PR was co-authored using Claude Code (Anthropic Claude Opus 4.7) in compliance with ASF.