PG1204 opened a new pull request, #6927:
URL: https://github.com/apache/texera/pull/6927

   ### 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`) in 
`JointUIService` that writes `rect.body/stroke` only when the color actually 
changes. Both `changeOperatorColor` and `changeOperatorState` route 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 `applyOperatorBorder` call from the operator-add handler and 
letting the validation pass set the border. I kept that call and used the guard 
instead, because `changeOperatorStatistics` already paints the border via 
`changeOperatorState` *without* checking validity. Dropping 
`applyOperatorBorder` would 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 where `setDynamicSchema` skips 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.
   - Full frontend suite: 3739 passing.
   
   Manual (navigated away from a running workflow and back), border restored 
correctly for:
   - Completed operators → green
   - Running operators → orange
   - Invalid operators → red
   - Valid, not run → default gray
   
   ### 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to