Skip to content

Code files in the right panel jump back to the top after switching file tabs #37348

Closed

Description

@pomykalakyle

What happened

When I open a file in the right panel and read it, then switch to another file tab, the first file is back at the top when I return to it.

Diagnosis

Code files lose their scroll position whenever their right-panel tab is hidden and shown again. My agent couldn't find anything in FilePreviewPanel.tsx that saves or restores the code view's scroll position, so the view likely remounts at scrollTop 0 on every tab switch (inferred from the source, not traced). #23503 fixes the same reset for rendered Markdown, but it stores the offset for the Markdown preview only, so code files will still reset after it merges. It also reproduces on main at b9bc038 (vp run dev with isolated state), so no newer build fixes it yet.

Steps to reproduce

  1. Open a project, open the right panel and go to Files.
  2. Open a long source file, for example apps/server/src/ws.ts (about 3,700 lines), and scroll down to about 4,200 px.
  3. Open apps/server/src/serverSettings.test.ts so it gets its own tab.
  4. Click back to the ws.ts tab.

Expected: ws.ts is still at 4,200 px.
Actual: ws.ts is at the top (0 px).

Version

0.1.10-nightly.20261115.4749 (also reproduced on main at b9bc038)

Environment

macOS 26.7.1, Apple Silicon, desktop app

Evidence

scrollTop of .file-preview-virtualizer while showing ws.ts
before switching away:   4200
after switching back:    0 at 100 ms, 600 ms and 2 s
same result with a caret placed in the file before switching

Related issues

#22300 and #23503 cover the same reset for rendered Markdown only. #30486 was the same bug in the diff panel (fixed).

Fix applied or workaround

No response

Filed by

claude (opus-5.5) in T3 Code, following the t3 triage playbook by hand

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

    via-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