tanishqgandhi1908 opened a new pull request, #9367:
URL: https://github.com/apache/texera/pull/9367
### What changes were proposed in this PR?
A version preview could outlive the workflow it was opened in. Previewing a
version turns off autosave and stores the open workflow so the ← arrow can put
it back. That state lives in root services, and only ← or "Restore this
version" reset it. Browser Back is the only other way out of a preview, and it
left the state in place. So the next workflow opened was stuck in preview mode:
- its edits weren't saved;
- pressing ← loaded the first workflow's graph into it;
- that graph was then saved over it.
When the workspace is left, `WorkspaceComponent.ngOnDestroy` now calls a new
`WorkflowVersionService.discardOpenVersionDisplay()`. If a preview is still
open, that method:
- drops the stored workflow;
- turns autosave back on;
- clears the preview flag.
It runs after `clearWorkflow()`, so the clear itself still happens with
autosave off. Handing the workflow to its own Form View is not leaving, so the
preview is kept there.
The graph is deliberately not reloaded on the way out. Doing what ← does at
that point empties the closing workflow's co-editing document: the reload's
deletions reach the room, but its re-added operators are rendered
asynchronously and the document is destroyed first.
| Before | After |
|---|---|
| _(screenshot)_ B opens stuck in A's preview | _(screenshot)_ B opens
normally |
| _(screenshot)_ B reopened shows A's operators, saved into B |
_(screenshot)_ B keeps its own operator |
### Any related issues, documentation, discussions?
Closes #9354.
### How was this PR tested?
- New `WorkflowVersionService` tests:
- `discardOpenVersionDisplay` ends an open preview (it resets the temp
workflow, turns autosave on and clears the flag and selected version) without
reloading the graph;
- it does nothing when no preview is open.
- New `WorkspaceComponent` test: leaving the workspace discards the preview
after `clearWorkflow()`. The Form View hand-over test now also checks that the
preview is kept.
- With the fix removed, the two new behaviour tests fail.
`workflow-version.service` and `workspace.component` specs pass (70 tests).
Prettier and eslint are clean.
- Manually on a local stack, following the issue's steps:
- B opens normally;
- an edit to B is saved;
- a new session shows B's own content;
- A keeps its content with no extra versions;
- the ← arrow still closes a preview and the next edit saves to A.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
--
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]