Repository navigation
Description
The problem
When reading a text diff in History, maximizing a small window sometimes leaves large blank gaps between lines. The text unwraps to fit the wider preview, but the rows retain the height they needed when the preview was narrow.
This is intermittent in the current, unfixed application: sometimes resizing works correctly, and sometimes it does not. Moving the divider between the changed-file list and the diff preview fixes the spacing. After that, restoring and maximizing the same diff can continue to work correctly. Selecting a different commit while the window is small can make the problem return on the next maximize.
Expected: row heights should adjust to the wrapped text whenever the preview changes size, without needing to move the divider.
This happens in the text diff viewer, not a rendered Markdown preview. No error message was reported.
Release version
3.6.7
Operating system
Windows 11 25H2
Steps to reproduce the behavior
The following sequence was observed before the fix. Not every maximize triggers the problem.
- Open History in a small window.
- Select a commit containing a text file with at least two long lines, such as NEXT.md. Make the preview narrow enough that the lines wrap several times.
- Maximize the window. When the bug occurs, the text unwraps but large vertical gaps remain between rows. Other maximize attempts can resize correctly.
- Move the divider between the changed-file list and the diff preview slightly. The row spacing becomes correct.
- Restore the small window, then maximize again. In the observed sequence, the spacing now adjusts correctly, even without the fix.
- Restore the small window and select a different commit containing long wrapped lines.
- Maximize again. In the observed sequence, the oversized row spacing returns.
Log files
No response
Screenshots
- Small initial window :
2. Windows maximised, row heights fail to adjust
3. Divider moved manually, row heights adjusts correctly
Additional context
Observed in a local fork of GitHub Desktop. The investigated base commit is bebc062caa on development.
Investigation points to stale measurements in SideBySideDiff, which renders both unified and side-by-side diffs using react-virtualized's AutoSizer, List, and CellMeasurer. The resize callback clears CellMeasurerCache, but does not explicitly recompute the list's row heights and positions.
AutoSizer calls setState with the new dimensions before invoking onResize. Outside React event batching, this can render the wider diff while the narrow-width measurements are still cached. The subsequent cache clear does not trigger another render, leaving oversized rows visible. Another resize can remeasure using the now-empty cache, explaining the divider recovery and successful later resize cycles. Switching commits can populate the cache again at the narrow width, causing the next maximize to fail again.
A suggested fix calls this.virtualListRef.current?.recomputeRowHeights() after clearing the measurement cache.
Component tests reproduce both the failing and working sequences before the fix:
| Controlled test sequence | Before fix | With suggested fix |
|---|---|---|
| First narrow-to-wide resize with cached wrapped heights | Incorrect: 180px instead of 20px | Correct |
| Divider adjustment followed by restore/maximize | Correct | Correct |
| Switch commits while narrow, then maximize | Incorrect: 180px instead of 20px | Correct |
These tests mount the actual diff and virtual-list components in jsdom with deterministic layout measurements. They confirm the resize lifecycle and row offsets; they do not automate native Windows maximize controls or actual font wrapping. The table describes controlled sequences, not a claim that every maximize fails before the fix.
Activity
desktop-triage commentedon Oct 17, 2026
Classification: Bug
Priority: P3
This is a bug report with a clear reproduction scenario and a specific root-cause theory tied to the diff viewer's virtualization logic, though the trigger is intermittent and affects a visual/cosmetic aspect (row spacing) rather than core functionality, with a workaround (nudging the divider). I'm suggesting
bugandpriority-3.Initial hypothesis: The reporter's analysis is consistent with the code.
SideBySideDiffwraps itsreact-virtualizedListin anAutoSizerwhoseonResizecallback only callsclearListRowsHeightCache(desktop/app/src/ui/diff/side-by-side-diff.tsx
Lines 980 to 982 in bebc062
CellMeasurerCache(desktop/app/src/ui/diff/side-by-side-diff.tsx
Line 631 in bebc062
recomputeRowHeights()on theListref afterward (a call to that API exists elsewhere in the file, atdesktop/app/src/ui/diff/side-by-side-diff.tsx
Line 1293 in bebc062
AutoSizerupdates its own dimension state before invokingonResize, theListcan re-render at the new width using stale (narrow-width) cached row heights for rows not yet remeasured, producing oversized gaps until another cache-clearing event (e.g., moving the divider) forces remeasurement. This matches the reporter's "divider fixes it" and "switching commits while narrow repopulates the stale state" observations. I did not independently reproduce the native resize timing race in Electron; the reporter's jsdom-based component tests are the only confirmation presented so far.Duplicate Check: Searched for related issues on diff row-height/resize problems; found no existing open or closed issue describing this specific wrapped-row/resize/CellMeasurerCache interaction. No duplicates found.
Suggested Next Steps: Ready for engineering review — the reporter has a plausible fix (
recomputeRowHeights()after cache clear) and claims to have component tests reproducing both failing and fixed behavior, which would help verify a PR.Shriraj1901 commentedon Oct 28, 2026
Hi @williammartin , I'd like to investigate this issue. I'll reproduce the incorrect row heights during window resizing and trace how the diff viewer refreshes its measurement cache. I'll look into whether the list needs to recalculate row heights after the cache is cleared, and add regression tests for the resize behaviour. Could you please confirm whether this issue is available for an external contribution and assign it to me if appropriate?