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

   ### What changes were proposed in this PR?
   
   Closes #8601, the two instances left out of #8600.
   
   `HubWorkflowDetailComponent` bound its `ngOnDestroy` to 
`window:beforeunload` as well, so leaving the page cleared the workflow out of 
the shared graph. Leaving a document is not discarding it: Chrome may keep it 
in the back/forward cache and restore it on the way back with its JavaScript 
state exactly as it was left, re-running nothing. Anything destroyed from a 
`beforeunload` binding therefore stays destroyed on a page that looks live -- 
here, the preview would come back to an empty canvas.
   
   The binding goes. The clear stays in `ngOnDestroy`, which Angular runs when 
the route really leaves, which is where it belongs. This is the fix #8600 
applied to the workspace and the Form View for the same shape (#8599).
   
   The issue's second instance, `AgentPanelComponent`, is deliberately left 
alone: it deactivates an agent from its `beforeunload` binding, and whether 
deactivating on unload releases something server-side that ought to be released 
is a judgement about that subsystem rather than a mechanical application of 
this rule. Worth an opinion from someone who knows it. The app's other four 
`beforeunload` bindings only write panel geometry to `localStorage`, which is 
exactly what that event is for.
   
   ### Any related issues, documentation, discussions?
   
   Closes #8601. Same shape as #8599, fixed elsewhere in #8600.
   
   ### How was this PR tested?
   
   Unit tests (vitest), in the component's own spec: a `beforeunload` event on 
the window leaves the workflow alone, and `ngOnDestroy` still clears it. 
Deletion-checked both ways -- dropping the clear turns the destroy test red, 
and putting the `@HostListener("window:beforeunload")` decorator back (with its 
import) turns the unload test red.
   
   eslint, prettier and the production (AOT) build pass; the full frontend 
suite passes.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Code (Anthropic). Co-authored with Claude, 
reviewed line by line by the author 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