You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad085e9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(workspace, workflow-form): show the step the shared selection already holds (apache#9408)
### What changes were proposed in this PR?
Closesapache#9400.
A workflow's two views share one selection: it lives in the
root-provided `JointGraphWrapper`, which the switch between the canvas
and the Form View hands over rather than rebuilds. Nothing is lost in
the switch, but everything that shows the selection followed only the
highlight streams and never read it when it mounted. The event that made
the selection had already happened, so the view arriving at it waited
for an event that never came: the panel showed nothing, and the step was
drawn as not selected. Clicking that step did not help, since the
wrapper treats an already-highlighted element as a no-op and emits
nothing; it took clicking a *different* step to bring the panel back.
Each of the three now reads the selection it mounts into, then follows
the changes as before:
- `PropertyEditorComponent` (the canvas's panel and every host of it, so
not specific to the Form View, to any operator type, or to operators as
opposed to ports): the body of the highlight subscription becomes
`showHighlighted()`, the same decision as before (one operator, one
port, or nothing) with the `syncTexeraGraph` guard that the stream
applied as a `filter` now inside it, so it is applied once on both
paths. `registerHighlightEventsHandler()` calls it before subscribing,
and only when something is highlighted: the no-frame branch is for a
selection being dropped (it clears the editing marker on the shared
awareness channel and resizes the docked panel to its empty content),
which a fresh mount must not do. It is also called after the toolbar's
choosing toggle has replayed its value, so the frame it builds carries
`choosing` from the start instead of being torn down and rebuilt by the
replay inside the page's first change-detection pass. Not `startWith` on
the stream: its initial emission is unconditional, which is exactly the
empty-branch-at-mount this avoids.
- `WorkflowEditorComponent`: the ring. The paper is new on every switch,
and the highlighter was applied only from the stream, so the arriving
view would have shown its panel for a step drawn as not selected. The
handler now rings the operators and comment boxes the wrapper already
holds, then follows the streams; the `findViewByModel` guard the
unhighlight branch already had is shared with it.
- `WorkflowFormComponent`: one call to the
`syncSelectionFromHighlight()` it already has, in `ngOnInit` after it
subscribes, so the form's step panel opens on the selection it arrives
with. The template note that justified `[hidden]` over `*ngIf` by the
panel having "no initial pull" is reworded to the reason that still
holds.
No change to who owns the selection, to what a click does, or to the
canvas's own behaviour when it is the only view open: with nothing
selected, nothing is read, and both panels mount empty exactly as
before. The wrapper's no-op for an already-highlighted element is
deliberately untouched (it is what keeps a shift-selection stable); it
simply stops mattering, because the arriving view already shows that
step.
#### Video
**Before**
https://github.com/user-attachments/assets/e00affd4-46aa-4691-acc4-5d33060da766
**After**
https://github.com/user-attachments/assets/f50674e4-b0fd-4941-bcca-860d1aa61abe
### Any related issues, documentation, discussions?
Closesapache#9400. Part of the Form View (apache#8011).
Related to apache#8846, which touches `workflow-form.component.ts` elsewhere
and does not read the selection on mount: its `frameWrites` guard
compares `selectedOperatorId`, which only `syncSelectionFromHighlight()`
sets, so on arriving in the Form View with a step selected that guard
saw `undefined` and the form wrote the declared parameters even while
the live panel showed that step. With this change `selectedOperatorId`
is set on arrival and the guard holds. The two do not overlap in code;
whichever lands second rebases.
### How was this PR tested?
- `property-editor.component.spec.ts`: a panel mounting into an existing
selection shows that operator; mounting into no selection leaves the
panel alone and mounting into two shows no frame (the two-operator
selection is made explicit with `setMultiSelectMode(true)` and asserted
before the check); and the frame a panel mounts into is built with the
toolbar's choosing state, with no rebuild, which pins the order of the
two subscriptions.
- `workflow-editor.component.spec.ts`: wiring the highlight handler into
a selection the wrapper already holds rings that operator once (a spy
installed after the stream has done its work).
- `workflow-form.component.spec.ts`: the form's step panel opens on the
step the canvas had selected, and stays closed for none or several —
seeded with a stale id, so a read that never happened could not pass as
"undefined".
- Existing specs for all three components pass unchanged; they cover
what the streams do after mount.
- The full frontend suite, eslint, prettier and the production (AOT)
build pass.
- By hand on a local deployment, `main` (`cfca8e1e5`) and this branch
served side by side on the same backend and the same workflow, driven by
a Playwright probe that reads what the panel shows at each step:
| step | main | this branch |
| --- | --- | --- |
| click the step on the canvas | the step | the step |
| switch to the Form View | empty | the step, ringed on the preview |
| click that same step on the preview | empty | the step |
| switch back to the canvas | empty | the step, ringed on the canvas |
### Was this PR authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (Claude Fable 5.1, Anthropic).
Co-authored with Claude, reviewed line by line by the author before
submission.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <[email protected]>
0 commit comments