Skip to content

fix(ui): keep the graph zoom when expanding or collapsing groups - #1282

Merged
mkceichelbeck merged 10 commits into
the-open-engine:mainfrom
pronei:claude/zeroshot-node-zoom-issue-0b6e69
Oct 23, 2026
Merged

mkceichelbeck merged 10 commits into
the-open-engine:mainfrom
pronei:claude/zeroshot-node-zoom-issue-0b6e69

Conversation

@pronei

@pronei pronei commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expanding or collapsing a workflow group preserves its screen position and zoom. Clicking Fit while a group is laying out fits the completed graph from its rendered positions and sizes, so stale React Flow measurements cannot clip the expanded group.

Fixes #1281

Validation

  • npm --prefix ui test: 413 passing. New regressions cover four- and six-agent parallel profiles in 1106 px and 722 px canvases, with ResizeObserver measurements held stale through the completed layout. A delayed-frame case also verifies saved-view restoration and Collapse all, with explicit waits for the expected viewport.
  • npm --prefix ui run build.
  • Chromium against the local zero-cloud shell at 60937562, using the built PR assets and fixture-backed workspace APIs: six Profiles/run-history scenarios at wide and narrow widths, including nested toggles and an open inspector; four native-validated parallel-profile clipping cases. All ten pass, including Fit clicked while ELK layout is held pending.
  • Repository formatting, lint, tooling tests, distribution checks, and Opcore 0.3.2 full Fast source checks pass.

@pronei
pronei marked this pull request as ready for review October 21, 2026 19:32
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Expanding or collapsing a group keeps its screen position and zoom. Fit requests made during expansion use the completed graph’s drawn sizes.

  • Workflow groups stay in the same screen spot when opened or closed.
  • Fit uses the completed layout when a group is still arranging.

Reviews (6) · Last reviewed commit: "test(ui): await the requested viewport b..." · Reviewed by Greptile

Comment thread ui/src/workflow-viewport.test.ts
@greptile-apps

greptile-apps Bot commented Oct 21, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

@mkceichelbeck mkceichelbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! I checked it in Chromium and found a few things to address before merging:

  • Expanding centres the group, but #1281 asks to keep it in the same screen position. The new test currently expects centring too.
  • Placement sometimes reads temporary React Flow geometry. I reproduced collapse drift in Profiles and expanded groups ending partly offscreen on narrow views. Please use the completed layout coordinates, or wait for that exact layout to reach the store; another fixed frame delay would leave the race.
  • Clicking Fit while an expansion is laying out gets overridden when the layout completes. Clearing the pending toggle on Fit and consuming it inside the guarded callback passed a base/head regression probe.

Using the same anchoring path for expand and collapse should also let us drop the centring-specific bounds traversal. Please add regressions for these cases and remove the generated-by footer from the PR description.

pronei and others added 7 commits October 22, 2026 13:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The anchoring added for group toggles took WorkflowCanvas to 343 lines,
over the 300-line function limit the Opcore source check enforces. The
collapse, expand and collapse-all handlers and the view placement after
a toggle now live in a useGroupToggles hook beside useCanvasView.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the viewport helpers were tested, not the wiring that places the
view once a toggle's layout is drawn. These tests mount the read-only
run graph in jsdom with ELK running in process. They check that Expand
centres the group and Collapse keeps its card at the same screen spot,
both at the saved zoom, and that Collapse all clicked while an Expand
is still laying out ends in a whole-graph fit.

The ResizeObserver stand-in reports an element again when its inline
size changes, so React Flow measures nodes as a browser would and its
fitView runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expanding a group now keeps it where it was on screen, as the-open-engine#1281 asks, instead of
centring it. Expand and collapse share one anchoring path, so the member-bounds
traversal goes.

The anchor and the group's new position are read from the nodes the canvas draws,
in an effect on the layout state, rather than from React Flow's store two frames
after the layout. The store learns a layout only after a render, so that read could
still see temporary positions: collapse drift in Profiles, and expanded groups
landing partly offscreen on narrow views.

Fit while a toggle is laying out marks the pending toggle, which then fits the
finished layout instead of overriding the fit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@pronei
pronei force-pushed the claude/zeroshot-node-zoom-issue-0b6e69 branch from cd32834 to cb960cd Compare October 23, 2026 00:09
@pronei

pronei commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Hey Michael, I've made the following edits to reflect #1281

Addressed in cb960cd:

  • Expand now keeps the group where it was, like collapse. The centring path and its bounds traversal are gone, and the test expects anchoring.
  • The anchor and the new position are read from the nodes the canvas renders, in an effect on the layout state, so nothing waits on frames or reads React Flow's store. A test fires frames before React has drawn the layout and still sees 0 px drift.
  • Fit during a toggle marks the pending toggle, which then fits the finished layout. Covered by a test.

Michael Eichelbeck added 2 commits October 23, 2026 21:30
Calculate a pending Fit from the completed canvas rectangles so stale React Flow
measurements cannot clip expanded groups. Cover four- and six-agent parallel
profiles in wide and narrow canvases while ResizeObserver reports are delayed.
mkceichelbeck
mkceichelbeck previously approved these changes Oct 23, 2026

@mkceichelbeck mkceichelbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feedback is addressed. Verified the built UI inside zero-cloud's Profiles and run-history frames with fixture-backed workspace APIs, including narrow panes, nested group toggles, and Fit requested while ELK layout is pending. The four- and six-agent clipping cases now fit the completed rectangles, including while measurements remain stale. All 412 UI tests, the UI build, and the current head's CI checks pass.

@mkceichelbeck
mkceichelbeck added this pull request to the merge queue Oct 23, 2026
@mkceichelbeck
mkceichelbeck removed this pull request from the merge queue due to a manual request Oct 23, 2026
Wait for saved-view restoration and completed-layout fitting before treating a quiet canvas as settled. Cover delayed animation frames explicitly.

@mkceichelbeck mkceichelbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the viewport fix and added regressions. All 413 UI tests pass, including stale-measurement fitting at both pane widths and delayed viewport restoration. All ten Chromium scenarios pass in zero-cloud’s local embedded Profiles and run-history UI, using the built PR assets and fixture-backed APIs, including nested group toggles, a narrow inspector pane, and Fit during a pending layout. Required CI checks pass for this commit.

@mkceichelbeck
mkceichelbeck added this pull request to the merge queue Oct 23, 2026
Merged via the queue into the-open-engine:main with commit 83a2f0c Oct 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Run graph resets zoom and pan when a group is expanded or collapsed

2 participants