feat(sidebar): merge vault browser into files tab + UX polish#526
Merged
backnotprop merged 3 commits intomainfrom Apr 8, 2026
Merged
feat(sidebar): merge vault browser into files tab + UX polish#526backnotprop merged 3 commits intomainfrom
backnotprop merged 3 commits intomainfrom
Conversation
Both the Bun and Pi annotate servers were missing the three Obsidian reference endpoints (/api/obsidian/vaults, /api/reference/obsidian/files, /api/reference/obsidian/doc), making the vault browser unavailable in annotate mode. Added the handlers to both servers. For provenance purposes, this commit was AI assisted.
Vault is conceptually just another directory — same tree UI, same expand/collapse, same annotation counts. Rather than maintaining a parallel tab and hook, vault now appears as a collapsible section inside the Files tab alongside any other configured directories. Changes: - Add `isVault` flag to `DirState` and `addVaultDir()` to `useFileBrowser` — fetches from the Obsidian endpoint and stamps the dir so downstream code can route to the correct API - Remove `useVaultBrowser` hook and `VaultBrowser` component entirely - Remove `"vault"` from `SidebarTab` type - Update `App.tsx`: drop all parallel vault state; wire vault into the combined file browser fetch effect; update `handleFileBrowserSelect` to pick the right URL builder based on `isVault`; update `handleOpenLinkedDoc` and annotation count derivation to cover vault dirs via the same path - Fix sticky header lane: remove the `!linkedDocHook.isActive` gate that was suppressing sticky headers for linked docs and annotate mode - Remove primary border on linked doc viewer card - Add `ObsidianIcon` (full branded logo) and `ObsidianIconRaw` (compact purple mark) to `packages/ui/components/icons/ObsidianIcons.tsx` - Display `ObsidianIconRaw` in the FileBrowser directory header for vault dirs Net: -334 lines. One Files tab handles all directory types uniformly. For provenance purposes, this commit was AI assisted.
Three issues identified in review: 1. Switching vault paths accumulated stale sections — addVaultDir now atomically replaces all existing vault dirs instead of appending, so changing the configured vault never leaves a ghost section behind. 2. Disabling the vault left the old section visible until reload — a new clearVaultDirs() method prunes all isVault entries, called via a dedicated effect that fires whenever vaultPath becomes empty. 3. Vault load failures were unrecoverable in-session — the Retry button only called fetchAll(regularDirs). FileBrowser now accepts an onRetryVaultDir prop and routes vault dir retries to addVaultDir (which re-fetches from the Obsidian endpoint) instead of the regular-dirs-only fetchAll. For provenance purposes, this commit was AI assisted.
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.
Summary
isVaultflag onDirStateand anaddVaultDir()method inuseFileBrowser— same tree UI, same annotation counts, no parallel state.ObsidianIcon(full branded logo) andObsidianIconRaw(compact purple mark) inpackages/ui/components/icons/ObsidianIcons.tsx. The raw icon appears in the FileBrowser directory header for vault dirs./api/obsidian/vaults,/api/reference/obsidian/files, and/api/reference/obsidian/doc. Added to both.!linkedDocHook.isActivegate that was suppressing the sticky header lane when viewing linked docs.Net change: -334 lines. One Files tab handles all directory types uniformly.
Test plan
plannotator-annotateopens vault files correctly (vault endpoints present on annotate server)