Skip to content

Avoid trace image resets on unchanged resize events - #2126

Merged
leaf-agent merged 3 commits into
mainfrom
fix/ci-37863827619-viewer-refresh
Oct 9, 2026
Merged

leaf-agent merged 3 commits into
mainfrom
fix/ci-37863827619-viewer-refresh

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

An unchanged resize event was making the open trace image reapply its zoom and pan, which wrote the same Viewer styles repeatedly and forced page geometry reads. This change refits the image only when its container dimensions change, while preserving the inspection after a resize signal.

The failed main run included two margin refresh failures. Both reproduced on current main before this change and passed after it. The trace inspection journey, including a same-size resize signal, also passed on Python 3.12.

The run's other failures concern focused reading position, stylesheet wording, the reader state probe, and trace gallery layout and rest state. The first three have since received separate changes on main; the trace gallery failures still need their own repair.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The new size guard never skips an unchanged resize. .lf-trace-canvas has a one-pixel border on each side, so its clientWidth and clientHeight stay two pixels below Viewer's dimensions (960×640 versus 958×638 in the browser probe). A same-size resize still wrote the image's style attribute 10 times. Viewer also handles the window resize event itself, so changing this comparison alone would let it reset the inspection view before Leaf decides whether to restore it. Let Leaf own Viewer's resize call and compare the same outer dimensions, then retain the inspection and assert that an unchanged signal writes no image styles.

The nightly margin checks caught repeated Viewer style writes and geometry reads on each resize event. Only refit an open trace image when its container dimensions change. Keep the user's zoom and pan after a same-size resize signal.
Viewer's own window listener refit the image on every signal, and the canvas border made the new client-size guard always true. Let the trace widget own resize calls using matching outer dimensions. The browser test now rejects redundant image style writes while retaining the zoomed inspection.
@leaf-agent
leaf-agent force-pushed the fix/ci-37863827619-viewer-refresh branch from 0eeee30 to 0e16f46 Compare October 9, 2026 02:37
@leaf-agent
leaf-agent merged commit 00e093c into main Oct 9, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-37863827619-viewer-refresh branch October 9, 2026 06:49
leaf-agent added a commit that referenced this pull request Oct 9, 2026
Five nightly browser checks in [main CI run
37880455978](https://github.com/max-sixty/leaf/actions/runs/37880455978)
were asserting older UI behavior. This changes their expected readings
to match the shipped interaction while retaining their checks of focus,
reachability, and stable search position. Each of the five failed on
`main` before the edit and passed with it.

- The compact comment and draft journeys now expect Send to focus the
conversation card, as
[#2116](#2116) intended.
- The banner journey accounts for the visible Copy control in More. The
command reference journey accounts for its preference checkbox as a
native Tab stop.
- At a 320 px tall viewport, the reference can stay at its height limit
after filtering because its fixed controls and empty result occupy the
available room. The test still requires a smaller dialog at taller
viewports, a steady search field, and a visible empty result.

Verification: the five named browser tests passed locally after failing
individually before the edit; all three viewport variants of the
reference filtering test passed. The run's margin failures are covered
by [#2126](#2126), and its trace
gallery failures remain recorded in
[#2128](#2128). The focused
visual review editor failure is separate from these outdated assertions.

Co-authored-by: leaf-agent <[email protected]>
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.

1 participant