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

   ### What changes were proposed in this PR?
   
   The operator canvas and the Form View are two views of one open workflow, 
but moving between them was a full browser page load. Everything that made the 
workflow live was thrown away on the way out -- the Yjs shared document and the 
co-editing room it holds, the computing unit connection, the execution state -- 
and rebuilt on the other side: an Angular bootstrap blocked on `/api/config`, a 
re-parse of the whole bundle, a re-fetch of the operator metadata a root 
singleton had already cached, a workflow fetch, a new room, a reconnect, and 
then a wait for the backend to report a run the page it just left already knew 
about.
   
   Both directions now route, and the session is handed over rather than 
rebuilt.
   
   * `isWorkspaceViewOf` (in `app-routing.constant.ts`) names the pair of URLs 
one workflow is open under. Each view asks it as it is destroyed, against the 
navigation in flight, and keeps the session when the destination is its 
sibling. No navigation in flight means the browser is unloading, which is 
leaving.
   * `WorkflowActionService.hasWorkflowOpen` answers whether the shared 
document is already in a workflow's room. Each view asks it before loading and, 
when the answer is yes, skips the fetch, the reset, the new shared model and 
the graph rebuild, taking the name and access from what is already open. The 
canvas additionally lifts the lock the Form View put on the graph, since 
editing is what a canvas is for, and centres its new paper.
   * `MenuComponent.openFormViewPage` and 
`WorkflowFormComponent.openCanvasPage` navigate instead of assigning 
`window.location.href`. The save-then-hand-over ordering around them is 
unchanged.
   
   Leaving the workspace altogether is unchanged: the same teardown, including 
on unload, where there is no navigation to ask about.
   
   **The papers.** Routing between these two views was tried during the Form 
View work and reverted, for three symptoms the code comments recorded. Two have 
causes, and both are removed here rather than avoided.
   
   The ghost coeditor of yourself was the shared document: the arriving view 
built a second one for the same workflow, so the page joined the room it was 
already in and saw its own other client. Not rebuilding it is what removes the 
ghost.
   
   The undraggable operators were the papers. A JointJS paper binds to the 
joint graph, which is root-provided and outlives the component that created it, 
and nothing ever disposed one -- neither `WorkflowEditorComponent`'s nor 
`MiniMapComponent`'s. Every mount left another paper listening to that graph 
from a detached DOM node, and whichever paper answered a pointer event decided 
whether an operator could be dragged. Harmless while every mount followed a 
page load; not once the views hand over in-process. Both are disposed on 
destroy now, which is a fix in its own right for any remount (the Hub's 
read-only preview does one too).
   
   The third symptom, broken runs, has no independent cause that I could find 
and is most likely a consequence of the other two. It is the part that most 
needs a browser.
   
   ### Any related issues, documentation, discussions?
   
   Closes #8580. Follow-up to the Form View feature (parent issue #8011); the 
switch itself landed in #8456.
   
   ### How was this PR tested?
   
   Unit tests (vitest), all new: each view keeps the session when its sibling 
takes over and releases it for any other destination; each view attaches to a 
workflow handed over still open instead of fetching and rebuilding it; each 
direction routes rather than reloading; `hasWorkflowOpen` is true only for the 
room the shared document is in; both papers are disposed on destroy.
   
   Eleven deletion checks, each restored afterwards: removing or inverting each 
new guard turns exactly one named test red. The twelfth guard, the empty-id 
check in `openCanvasPage`, cannot be deleted at all -- it is a compile error 
(TS2345), which the spec then pins at runtime as well.
   
   Full frontend suite: 223 files, 6070 passed, 1 skipped (pre-existing), 0 
failed. `ng build --configuration=production` (AOT) clean. `eslint` and 
`prettier --check` on every changed file: clean.
   
   **Draft because it is not yet verified in a running instance.** The value of 
this change is what a person feels when they switch, and the three symptoms 
above are exactly what unit tests cannot see. Before this leaves draft it needs 
a browser: switch both ways repeatedly, switch mid-run, switch with a second 
editor in the room, and check the co-editor list, operator dragging, and the 
running state after each.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Code (Claude Opus 5, Anthropic). Co-authored with 
Claude; the author reviewed the change line by line before submission.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY
   


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