Skip to content

[Bug]: Files tree forgets which folders were expanded on every remount #12041

Description

@cristip73

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 a thread in a repo with a deep directory layout.
  2. Open the Files surface in the right panel and expand your way down to something like apps/web/src/components/files/.
  3. Switch the right panel to another tab (Diff, Terminal, Preview), or switch to another thread and back. A window reload does it too.
  4. Return to the Files surface.

Expected behavior

The tree comes back the way I left it, with the same folders expanded, so I can keep working from where I was.

Actual behavior

The tree is fully collapsed again. Every folder on the path has to be re-opened by hand, every single time.

This is not a stale-cache problem, the state is simply never stored. In apps/web/src/components/files/FileBrowserPanel.tsx:287 expansion lives in a ref that is recreated on mount:

const expandedPathsRef = useRef(new Set<string>());

Mobile has the same shape in apps/mobile/src/features/files/FileTreeBrowser.tsx:122:

const [expandedPaths, setExpandedPaths] = useState<ReadonlySet<string>>(() => new Set());

Nothing writes either one to storage. The surrounding surface already persists plenty: open file tabs per thread in apps/web/src/rightPanelStore.ts (t3code:right-panel-state:v2), and even the explorer pane's own open/closed flag in apps/web/src/components/files/FilePreviewPanel.tsx:112 (t3code.fileExplorerOpen). So the tree's expansion is the odd one out, and it is the piece that costs the most clicks to rebuild.

Impact

Minor bug or occasional failure

Version or commit

0.0.41-nightly.20260910.1486

Environment

macOS 26.x, T3 Code Desktop (Nightly) 0.0.41-nightly.20260910.1486

Logs or stack traces

Workaround

None. Re-expand the path manually each time.

Related

GPT 6 Astra via Codex in T3 Code.

Activity

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.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