PG1204 commented on code in PR #5702:
URL: https://github.com/apache/texera/pull/5702#discussion_r3411515375


##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:
##########
@@ -397,10 +397,14 @@ export class WorkflowEditorComponent implements OnInit, 
AfterViewInit, OnDestroy
    * Centralizing this here avoids the race where the validation pass
    * overwrites a state-derived stroke (or vice versa) for an operator that
    * is both invalid and has a cached execution status.
+   *
+   * Callers that already have a Validation result (the validation stream
+   * subscriber) may pass it in to avoid recomputing it; callers without one
+   * (the operator-add stream subscriber) let the helper fetch it lazily.
    */
-  private applyOperatorBorder(operatorID: string): void {
-    const validation = 
this.validationWorkflowService.validateOperator(operatorID);
-    if (!validation.isValid) {
+  private applyOperatorBorder(operatorID: string, validation?: Validation): 
void {
+    const resolved = validation ?? 
this.validationWorkflowService.validateOperator(operatorID);
+    if (!resolved.isValid) {
       this.jointUIService.changeOperatorColor(this.paper, operatorID, false);
       return;
     }

Review Comment:
   Good question, but I think keeping the fallback would be good to have. It's 
there for the operator-add case, which fires before validation has been 
computed (separate event streams), so there's genuinely no validation result to 
pass in at that point. That path was added for the navigation-reset fix (#3614) 
and needs to color the border right away. The optimization just removes the 
duplicate computation on the validation-handler path, where we already have the 
result. Happy to revisit if you're seeing a case where validation always runs 
first.



-- 
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