Copilot commented on code in PR #3773:
URL: https://github.com/apache/texera/pull/3773#discussion_r2383651290


##########
core/gui/src/app/workspace/service/computing-unit-status/computing-unit-status.service.ts:
##########
@@ -153,17 +156,25 @@ export class ComputingUnitStatusService implements 
OnDestroy {
    */
   public selectComputingUnit(wid: number | undefined, cuid: number): void {
     const trySelect = (unit: DashboardWorkflowComputingUnit) => {
-      // open websocket if needed
-      if (isDefined(wid) && this.currentConnectedCuid !== cuid) {
+      if (!isDefined(wid)) {
+        return;
+      }
+
+      const shouldReconnect = this.currentConnectedCuid !== cuid || 
this.currentConnectedWid !== wid;
+
+      if (shouldReconnect) {
         if (this.workflowWebsocketService.isConnected) {
           this.workflowWebsocketService.closeWebsocket();
           this.workflowStatusService.clearStatus();
         }
+
         this.workflowWebsocketService.openWebsocket(wid, 
this.userService.getCurrentUser()?.uid, cuid);
         this.currentConnectedCuid = cuid;
-        this.selectedUnitSubject.next(unit);
+        this.currentConnectedWid = wid;
         this.startPollingSelectedUnit(cuid);

Review Comment:
   Early return when `wid` is undefined prevents the 
`selectedUnitSubject.next(unit)` call at line 177, which means the selected 
unit won't be updated even when a valid computing unit is available. This 
breaks the expected behavior when no workflow is selected but a computing unit 
should still be selectable.



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