Skip to content

feat(app): fold tall file diffs in the timeline - #65329

Merged
Tarquinen merged 2 commits into
anomalyco:devfrom
Tarquinen:cap-write-height
Nov 21, 2026
Merged

Tarquinen merged 2 commits into
anomalyco:devfrom
Tarquinen:cap-write-height

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

With edits set to expanded, a file diff in the timeline has no height limit, so a 300-line write takes over 7,000px. These blocks were capped at 420px (240px for writes) with inner scrolling until aaf8317 removed the caps when it added the expand setting.

Now an opened file diff shows at most 420px. A taller one fades out under a "Show more" button. "Show less" folds it again and keeps the button where it was pressed. Shorter diffs look the same as before. It covers writes, edits and patches in both timelines.

  • It folds instead of scrolling inside the block, following the long user message fold (UserMessageFold) and its existing ui.common.showMore / showLess strings, so there is no nested scrolling.
  • The limit always applies and the button lies over the faded end, so measuring the diff never changes its height. Shrinking it after measuring raised a "ResizeObserver loop" error each time a tall diff mounted.
  • Whether a diff is shown in full is component state, not kept in the timeline's disclosure store, so it does not survive the row being unmounted. Storing it means touching every fileOpen call site.
  • Pressing "Show more" while the timeline follows the end keeps the view pinned to the end, as opening a collapsed file already does.
  • Three existing specs change because an opened file now has a second button and long diffs open folded.
  • No flag: nothing in the timeline UI reads flags.

How did you verify your code works?

  • Added a case to packages/session-ui/component-tests/file-tool.spec.ts that opens a 200-line write, presses "Show more" and "Show less". It fails without the fix.
  • Loaded a 300-line write in the app timeline with the Detailed preset: the opened file is 7,201px on dev and 421px here, with no ResizeObserver loop error. A diff that wraps past the limit in a narrow window loses the button when the window widens and gets it back when it narrows.
  • strobe's "expand an edit" case, run once per side headless (--check --base origin/dev, 7 runs): main.work 35.9ms on dev, 34.6ms here. The timed comparison would not run on my machine (tiled window, on battery), so this is a reading, not a verdict.
  • bun run check, the session-ui component suite, and the patch-sticky-header, patch-border, timeline-geometry and session-timeline-tool-projection e2e specs pass.

Screenshots / recordings

dev this PR

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot 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.

Works as described. I mounted the long-write story in the component harness: the opened file goes from 4,801px on dev to 453px here, with the fade and the "Show more" toggle (screenshots below). The session-ui type check (tsc -b) and the full component suite (235 tests) pass. I did not run the app e2e specs or check the Show less scroll compensation by hand.

Public API: unchanged. This is UI only, in packages/session-ui.

No blocking concerns. One small point: tall is only ever set to true. If a diff later becomes shorter than the threshold, for example when a wider window unwraps its lines, it keeps a "Show more" toggle that reveals nothing. Resetting it in the resize callback would cover that.

Before

After

@opencodejr opencodejr Bot 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 new commits still work as described. In the component story, the opened 200-line write is 421px, 4,833px after "Show more" and 421px after "Show less". On dev it is 4,801px. The session-ui type check (tsc -b) and the full component suite (235 tests) pass.

My earlier point is addressed: tall is now measured again on every resize, so a diff that drops below the limit no longer keeps a toggle that reveals nothing.

Public API: unchanged.

No new concerns.

Before

After

@Tarquinen
Tarquinen merged commit 204af94 into anomalyco:dev Nov 21, 2026
14 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.

1 participant