Skip to content

Diff panel scroll jitters and snaps to the next file on a very large diff until the thread is switched #29967

Open

Description

@Palidos

What happened

Opened the Changes diff panel in a thread on a diff of about +31k lines. Scrolling down with a trackpad intermittently jitters and won't scroll freely. After the jitter the view snaps to the next file in the diff. It starts after the panel has been open for a while and isn't consistent. Turning line wrapping off did not stop it. Switching to another thread made it disappear.

Diagnosis

Unconfirmed. The logs show no renderer crashes and no server stalls, so it appears to be client-side. The diff panel uses the virtualized CodeView from @pierre/diffs 1.6.1. StyledDiffCodeView.tsx:242-253 sets fixed item metrics (header 32px, hunk separator 24px, padding 8px). StyledDiffCodeView.tsx:15-19 already notes that the virtualizer "repeatedly correct[s] the scroll position" in split + wrap mode. Wrap isn't the trigger here. Remaining candidates:

  • Height corrections when estimated and measured item heights differ, made worse by collapsed files.
  • Lazily loaded file patches (useReviewFilePatches, lazySource) resizing items mid-scroll.
  • State building up in the long-lived viewer. The codeViewKey remount (DiffPanel.tsx:~1384) clears it, which would explain why switching threads fixes it.

Steps to reproduce

  1. Open a thread with a very large diff (about +31k lines, many files).
  2. Open the Changes panel in split layout with some files collapsed.
  3. Scroll down with a trackpad and keep the panel open for a while.
  4. Intermittently the scroll jitters and snaps to the next file.
  5. Toggling line wrapping off doesn't help. Switching to another thread clears it.

Not yet tested: unified layout, all files expanded, or a smaller diff.

Version

0.1.6 (desktop app, the latest stable release, on the same machine as the report).

Environment

macOS (Darwin 27.0.0) arm64, Node v24.22.1, T3 Code Desktop 0.1.6 against the local server 0.1.6. Renderer working set about 520–560 MB, peak 657 MB.

Evidence

No relevant errors in `desktop.trace.ndjson`, `renderer-history.ndjson`, or `event-loop-stalls.ndjson`. The only stall is from Oct 20 and is unrelated. No `server-child` crash logs from this session.

Related issues

No duplicate found. Nearby but different: #28160 (horizontal trackpad scroll triggers back/forward), #11571 (diff tab loses scroll position when switching threads), #17674 (collapse all not applied to unloaded files in large diffs).

Fix applied or workaround

Nothing was run on the machine. Workaround: switch to another thread and back, which remounts the viewer.

Filed by

Claude Code (model claude-sonnet-5-5) via the T3 Code triage playbook.

Activity

  1. juliusmarminge commented on Nov 3, 2026

    @juliusmarminge
    Member

    We tried this on main at 61c3794c32 (web dev server, Chromium, split layout, Changes panel) and could not reproduce the jitter or the snap to the next file.

    What we ran:

    • A branch diff of +32,700 / −1,700 lines across 164 files, and a real-code diff of +30,586 / −6,838 lines across 778 files (it loads lazily, in batches).
    • Wrap on and wrap off. A mix of collapsed and expanded files (collapse all, then files that loaded later stayed expanded).
    • Scrolling down and up with small, trackpad-sized wheel steps (14–60 px, some with a sideways component), through the lazy-load boundary. We logged every scroll position change the viewer made on its own.
    • Leaving the panel open for 5.5 minutes, past the patch cache's stale time, then scrolling again. Refocusing the window and pressing refresh while scrolled mid-diff.

    The viewer never moved the scroll position on its own. The only stalls were where scrolling caught up with the end of the loaded files and waited for the next batch.

    To narrow it down, could you share:

    1. A screen recording of the jitter and the snap, with the diff panel's header and scrollbar visible.
    2. Whether an agent was running or editing files in that thread or project while you scrolled.
    3. Whether you had opened a file from the file tree, a chat diff link, or Find (⌘F) in the panel before it started.
    4. Whether it also happens with a mouse wheel, or only with the trackpad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoInitial triage showed no bug. Awaiting more infovia-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions