Skip to content

fix: the Files tree keeps its opened folders while the panel is hidden - #242

Merged
bencode merged 1 commit into
mainfrom
fix/folder-expansion
Oct 26, 2026
Merged

bencode merged 1 commit into
mainfrom
fix/folder-expansion

Conversation

@bencode

@bencode bencode commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Which folders the reader had opened lived in ResourceTree's own state. The tree unmounts whenever Files is hidden on a wide screen, whenever the drawer closes on a narrower one, and when the window crosses the 1100px breakpoint, so each of these folded the library shut again, apart from the open file's folders.

  • useFolderExpansion in features/resources holds the opened folders, one set for Files and one for Attachments. The workbench calls it, so the state outlasts the panel; it is passed down through ResourcePanel to each tree.
  • Revealing the open file's folders moved with the state, still adjusted during render, so the tree does not show the folders folded for a frame. It now checks the active file against every file instead of the filtered ones. While a filter is set the tree shows its own filtered view, so the change is not visible; clearing the filter leaves the same tree as before.
  • The filter's own folded folders stay in the tree, since they reset with the filter anyway.
  • The state lasts for the page session only; a reload still starts folded.

The folded-folder integration test now hides and reopens Files before any file is open, and fails without the change.

Checked end to end on the tutorial project at 1500px and 900px:

  • examples and guide stay open after Hide/Open files, after the drawer closes and reopens, and after resizing across the breakpoint both ways.
  • Opening guide/Labs.md from Recent still opens guide.

Closes #195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep the Files tree where the reader left it — every panel close or phone-layout switch folds all folders back shut today

1 participant