Skip to content

feat(sidebar): merge vault browser into files tab + UX polish#526

Merged
backnotprop merged 3 commits intomainfrom
feat/improve-ux-linked-docs
Apr 8, 2026
Merged

feat(sidebar): merge vault browser into files tab + UX polish#526
backnotprop merged 3 commits intomainfrom
feat/improve-ux-linked-docs

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Vault → Files tab: Vault browser is removed as a separate tab. Vault now appears as a collapsible directory section inside the Files tab, alongside any other configured directories. Uses a new isVault flag on DirState and an addVaultDir() method in useFileBrowser — same tree UI, same annotation counts, no parallel state.
  • Obsidian icons: Added ObsidianIcon (full branded logo) and ObsidianIconRaw (compact purple mark) in packages/ui/components/icons/ObsidianIcons.tsx. The raw icon appears in the FileBrowser directory header for vault dirs.
  • Fix: annotate server vault endpoints: Both Bun and Pi annotate servers were missing /api/obsidian/vaults, /api/reference/obsidian/files, and /api/reference/obsidian/doc. Added to both.
  • Fix: sticky headers in linked doc / annotate mode: Removed the !linkedDocHook.isActive gate that was suppressing the sticky header lane when viewing linked docs.
  • Fix: linked doc border: Removed the primary-colored border on the viewer card when a linked doc is active.

Net change: -334 lines. One Files tab handles all directory types uniformly.

Test plan

  • Files tab shows project dir normally; no separate Vault tab
  • Enable Obsidian vault in Settings → vault appears as a collapsible section at the bottom of the Files tab with the Obsidian icon in the header
  • Click a vault file → opens in viewer correctly
  • Click a link inside a vault file → navigates correctly
  • Annotate a vault file → annotation count badge appears on the vault dir header
  • Disable vault in Settings → vault section disappears; Files tab still shows if project root exists
  • Sticky headers scroll correctly in linked doc and annotate mode
  • plannotator-annotate opens vault files correctly (vault endpoints present on annotate server)

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.
@backnotprop backnotprop merged commit 70dda02 into main Apr 8, 2026
7 checks passed
@backnotprop backnotprop deleted the feat/improve-ux-linked-docs branch April 8, 2026 23:07
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.

1 participant