Repository navigation
fix(frontend): clean up websocket state when returning to the dashboard (#5565) [release/v1.2 backport] - #5609
Merged
xuang7 merged 1 commit intoJun 10, 2026
Conversation
…rd (apache#5565) ### What changes were proposed in this PR? Websocket-derived front-end state (the connection itself, plus the execution status, console output, and results built from its events) lives in singletons outside the workspace. It was never torn down in two cases, so stale state carried over: 1. **Returning to the dashboard** and re-entering a workflow reused the previous socket. The connection-tracking fields (`currentConnectedWid` / `currentConnectedCuid`) also survived, so the reconnect guard saw them unchanged, skipped reconnecting, and reused the stale socket. (apache#3120 — the case apache#3093 did not cover.) 2. **Switching computing units** inside the workspace left the previous unit's console, results, and execution status on screen. This PR clears that state at both points. **Workspace exit**: `WorkspaceComponent.ngOnDestroy()` now tears everything down: | Call *(new)* | Resets | | --- | --- | | `ComputingUnitStatusService.disconnect()` | closes the socket, clears operator status, stops the unit poll, resets the connection-tracking fields and the selected unit | | `ExecuteWorkflowService.resetExecutionAndWorkers()` | execution status and worker assignments | | `WorkflowConsoleService.clearConsoleMessages()` | console output | | `WorkflowResultService.clearResults()` | result caches and table stats | **Unit switch**: `ComputingUnitStatusService` emits a reset signal when it reconnects to a different unit, and `WorkspaceComponent` clears the same execution / console / result state in response. As a result, switching units now discards the previous unit's results and console instead of leaving them on screen. The remaining websocket-event consumers need no teardown: `OperatorReuseCacheStatusService` is stateless, and `udf-debug.service`'s state lives in the `TexeraGraph`, already reset by `clearWorkflow()`. ### Any related issues, documentation, discussions? Closes apache#3120. Related: apache#3093 (earlier partial fix for the in-canvas socket re-open). ### How was this PR tested? Test with this workflow [Untitled workflow (14).json](https://github.com/user-attachments/files/28696700/Untitled.workflow.14.json) https://github.com/user-attachments/assets/060fe1ac-39cf-45e5-b423-5aa27fe17aed ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) --------- Co-authored-by: Xinyuan Lin <[email protected]> (cherry picked from commit ad10b7f)
Contributor
Author
|
/request-review @xuang7 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #5609 +/- ##
==================================================
+ Coverage 51.44% 51.58% +0.14%
Complexity 2445 2445
==================================================
Files 1065 1065
Lines 41184 41226 +42
Branches 4413 4415 +2
==================================================
+ Hits 21186 21266 +80
+ Misses 18757 18714 -43
- Partials 1241 1246 +5
*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?
Backport of #5565 ("fix(frontend): clean up websocket state when returning to the dashboard") to
release/v1.2.Applies as a clean
git cherry-pick -xof the merged squash commitad10b7f2b— no conflicts and no prerequisite chain (unlike the #5280 backport in #5602). Frontend-only: 14 files changed, 391 insertions, 2 deletions, identical to the original.For the full change description see #5565. In brief: websocket-derived front-end state (the connection, plus execution status, console output, and results built from its events) lives in singletons outside the workspace and was never torn down when returning to the dashboard or switching computing units, so stale state carried over. This tears that state down in
WorkspaceComponent.ngOnDestroy()and clears it again on a computing-unit switch.Any related issues, documentation, discussions?
Backports #5565 (which closes #3120 on
main). Related: #3093.How was this PR tested?
This is a backport with no changes beyond the single cherry-picked commit, so it relies on the existing tests carried over from #5565 (added
*.spec.tscases acrosscomputing-unit-status,workspace.component,execute-workflow,workflow-console,workflow-result,result-panel, andworkflow-websocket).Backport fidelity was verified locally: after the cherry-pick, every file touched by #5565 is byte-identical to its state on
mainat the merged commit (ad10b7f2b), andrelease/v1.2had no independent changes to any of those files.Full compile and unit-test runs are left to CI.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)