Skip to content

Fix stale text diff row heights after resizing - #23035

Draft
molnarriso wants to merge 1 commit into
desktop:developmentfrom
molnarriso:fix/diff-row-heights-on-resize
Draft

molnarriso wants to merge 1 commit into
desktop:developmentfrom
molnarriso:fix/diff-row-heights-on-resize

Conversation

@molnarriso

Copy link
Copy Markdown
Contributor

Closes #23034

Description

Maximizing a narrow History diff sometimes unwraps the text while leaving large gaps between rows. Resizing already works correctly in some sequences before this fix: moving the file-list divider repairs the spacing, and subsequent restore/maximize cycles can remain correct until switching commits in a narrow window.

  • Call List.recomputeRowHeights() after clearing the diff's CellMeasurerCache. AutoSizer can commit its new dimensions before invoking onResize, so clearing measurements alone leaves the rendered rows and cached positions stale. Explicit recomputation triggers measurement and rendering at the current size.
  • Reuse the existing cache-invalidation method, including its content-change callers, and safely handle an unavailable list ref.
  • Add regression tests for the first narrow-to-wide resize, divider recovery followed by restore/maximize, and switching commits while narrow before maximizing. The tests assert row heights and adjacent row offsets using the real diff and react-virtualized components with deterministic jsdom measurements.

Before the fix, the first and third regression scenarios fail with 180px spacing instead of 20px; the recovery scenario passes. All three pass with the fix.

Validation

  • All 21 targeted tests passed, including existing diff-row interaction and diff-expansion tests.
  • Type checking, targeted ESLint and Prettier checks, and git diff --check passed.
node script/test.mjs app/test/unit/ui/side-by-side-diff-resize-test.tsx app/test/unit/ui/side-by-side-diff-row-test.tsx app/test/unit/text-diff-expansion-test.ts

The new tests verify the component lifecycle with simulated dimensions.

Release notes

Notes: [Fixed] Keep text diff row spacing correct when resizing or maximizing the window.

@github-actions github-actions Bot added external Pull request originating outside of the Desktop core team needs-triage labels Oct 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Pull request originating outside of the Desktop core team needs-triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrapped diff rows sometimes retain oversized heights after maximizing the window

1 participant