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


##########
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:
   i agree with this, this would be a good follow up. The two paths currently 
run off separate event streams (operator-add restore vs. the validation 
stream), so unifying them so a new operator is validated/painted exactly once 
is worth doing, should be done carefully though, especially to preserve the 
#3614 navigation-reset behavior. I can file a follow-up issue to track it so we 
can keep this PR scoped. 
   Thanks!



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