Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/ui/components/panes/DiffPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,18 @@ export function DiffPane({
return next;
}, [allAgentNotesByFile, selectedFileId, showAgentNotes, visibleViewportFileIds]);

// Measure with the *full* set of agent notes per file, not just the visible-viewport set.
// The visible set is correct for rendering (skip painting cards on off-screen files), but
// using it here makes total content height fluctuate with scroll position: as a file with
// notes leaves the viewport, its measurement shrinks back to the no-notes baseline, which
// shrinks `totalContentHeight`, which tightens `clampReviewScrollTop`'s ceiling, which
// snaps the viewport upward by the height of the off-top note rows. Always include notes
// in geometry for stable bottom-edge clamping.
const sectionGeometry = useMemo(
() =>
files.map((file, index) => {
const visibleNotes = visibleAgentNotesByFile.get(file.id) ?? EMPTY_VISIBLE_AGENT_NOTES;
if (visibleNotes.length === 0) {
const notes = allAgentNotesByFile.get(file.id) ?? EMPTY_VISIBLE_AGENT_NOTES;
if (notes.length === 0) {
return baseSectionGeometry[index]!;
}

Expand All @@ -428,21 +435,21 @@ export function DiffPane({
layout,
showHunkHeaders,
theme,
visibleNotes,
notes,
diffContentWidth,
showLineNumbers,
wrapLines,
);
}),
[
allAgentNotesByFile,
baseSectionGeometry,
diffContentWidth,
files,
layout,
showHunkHeaders,
showLineNumbers,
theme,
visibleAgentNotesByFile,
wrapLines,
],
);
Expand Down