[Bug]: Diff tab loses scroll position when switching threads#11571

openedSep 13, 2026byAandykrchnk

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open two agent threads that both have a long diff in the Diff tab.
  2. In thread A, open the Diff tab and scroll down to a later file or hunk. Leave it there.
  3. Switch to thread B.
  4. Switch back to thread A.

Expected behavior

The Diff tab in thread A should restore the last scroll position, so review can continue from the same place.

Actual behavior

The Diff tab jumps back to the top. The previous scroll position is discarded, so a long diff has to be scrolled through again after every thread switch.

This happens while staying on the Diff tab; the trigger is switching threads, not switching right-panel tabs.

Related: #8759 covers losing Diff scroll/fold state when switching to another right-panel tab (Files, Browser, etc.) in the same thread. PR #8826 is open for that path and keys some viewport state by environment/thread, but the thread-switch roundtrip described here is still broken in current use.

Impact

Major degradation or frequent failure

It is consistent and especially painful on long diffs, which are common when reviewing agent work across multiple threads.

Version or commit

Current T3 Code (observed 2026-09-13)

Environment

Linux (Ubuntu 26.04), T3 Code web/desktop UI

Workaround

Stay in one thread until the review is finished, or re-scroll the Diff tab after every switch.

Existing fix: #11631. It covers this exact Diff → thread B → thread A round trip and includes before/after web recordings. Linked it as the closing PR; no duplicate PR opened. The PR remains open for maintainer approval. This triage pass checked existing work and did not independently rerun the browser reproduction.