Repository navigation
fix(sidebar): remember collapsed folders per vault - #124
Merged
Merged
Conversation
Every start opened all sidebar folders expanded: the collapsed state lived only in the component. Each vault in settings.json now keeps the folders shown collapsed (`collapsed_folders`); any other folder still opens expanded, so existing settings behave as before. The new `save_collapsed_folders` command runs on the worker, since each settings save reads the credential store. It keeps only valid vault-relative paths that are still folders, so renamed and deleted ones drop out (all valid paths are kept while the vault folder is unavailable). The sidebar saves one call at a time, latest state per vault, and a renamed folder stays collapsed.
On non-Windows targets the junction check is compiled out, leaving an `if` that returns `true` followed by `false`; Rust 1.100's clippy flags it and CI's lint job failed. The reparse-point flag is now a value that is `false` off Windows, with the same result on every platform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and resulting behavior
The sidebar kept the collapsed folders only in the component, so every start opened all folders expanded and the layout the user left was lost.
Now each vault in
settings.jsonkeeps the folders shown collapsed:VaultConfig.collapsed_folders(serde default, so existing settings behave as before: any folder not listed opens expanded).save_collapsed_folders(vault_id, folders)runs throughon_worker, since each settings save reads the credential store.vault::collapsed_folderskeeps only valid vault-relative paths (safe_join) that are still folders, once each, capped at 10,000; renamed and deleted folders drop out. While the vault folder is unavailable (unplugged drive) every valid path is kept.Validation
bun run version:check,bun run check,bun run check:e2e,bun test(121 pass), Python script tests: OK.cargo fmt --check,cargo clippy --lib --tests -- -D warnings,cargo test --locked --lib(200 pass): OK. New testvault::tests::collapsed_folders_keep_existing_folders_once.bun run buildandbun run test:e2e(47 pass), including the newtests/e2e/folder-tree.pw.ts(opens a remembered folder collapsed, saves each toggle).tests/note-tree.test.ts.Additional context
The settings file is local; nothing changes in the sync protocol. Older versions ignore the new field and drop it on their next save.