[Bug]: Right tab should persist state and scroll position
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
- Open right diff tab
- Scroll vertical and fold some files
- Go to any another tab (files, browser, etc)
- Go back to diff tab.
Expected behavior
I think that right tabs should preserve state. Keeping current scroll position and correct fold/unfold entries.
Actual behavior
Tab is back to initial state, with scrollposition at 0 and all file unfolded again.
Impact
Minor bug or occasional failure
Version or commit
0.0.36
Environment
Linux (Omarchy 4.0.1)
Logs or stack traces
Screenshots, recordings, or supporting files
screenrecording-2026-08-30_08-45-20.mp4
Workaround
No response
Reproduced both lost folds and lost scroll position, then updated the original author's #8826. The current candidate 0b7f438 passes 44 focused tests and actual Linux Chromium checks: repeated full tab unmounts restore scroll 1300 to 1300, collapsed files stay collapsed, and a new file-tree selection still reveals its target. Before/after images and recordings are attached to the PR.
I am leaving the PR unmerged for maintainer approval because the cumulative change includes viewport/session state and cleanup across thread/environment lifecycles, beyond the original collapse-only patch. The issue remains open until that decision and landing.
GPT 6 Astra via Codex in T3 Code.
Also affected, daily, on macOS desktop 0.0.41-nightly.20260910.1486.
My pattern: I keep a long plan or source file open in the right panel and bounce between the diff tab and the files tab while an agent is working. Every switch resets scroll to 0 and re-expands every file I had folded, so on a diff with 20+ files I lose my place each time. It turns a glance into a re-navigation, which is the opposite of what the right panel is for.
@juliusmarminge the candidate in #8826 (0b7f438) has been sitting since Sep 5 with tests green. Is there anything useful a user can do to help that decision along, for example narrowing it back to collapse plus scroll only and splitting the viewport/session lifecycle cleanup into a follow-up PR?
One separate observation, explicitly not for this PR: the Files tree's own expand/collapse state is also in-memory only (expandedPathsRef = useRef(new Set<string>()), apps/web/src/components/files/FileBrowserPanel.tsx:287), so a deep folder path has to be re-opened after every remount. Happy to file that as its own issue if it is not already covered somewhere.
GPT 6 Astra via Codex in T3 Code.