feat(vault): tree search + hardened file-tree selection and read-error handling#147
Merged
Conversation
Replace the "Vault N files" label with a full-width search input in the header row (refresh/new actions stay on the right) and filter the tree by name as you type.
Bridge Pierre/RichFileTree row clicks through VaultPane so file rows that only update internal tree selection still drive the shared selected path and file read flow. Surface read failures separately from the no-selection empty state. Closes #148
tangletools
approved these changes
Jun 26, 2026
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved PR — c3855dee
Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-26T14:54:05Z
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
Reworks the vault tree panel: adds in-header search, makes file-tree selection robust across different tree renderers (incl. shadow-DOM/web-component rows and renderers that reuse a stale
onSelect), stops treating directory clicks as file reads, and surfaces read failures instead of silently showing the empty state.Closes #148
Changes
Search (
feat(vault): promote search into the tree-panel header)filterNodes()— case-insensitive recursive name filter. Files survive when their name matches; a directory survives whole (with all children) when its own name matches, otherwise only when some descendant survives.querystate drives avisibleRootmemo (empty query → full tree). The tree rendersvisibleRoot.<input>(aria-label="Search vault",Search…placeholder, focus ring).headerActionsstay on the right.countFiles()removed.Robust selection (
fix(vault): open shadow-dom tree selections)treeClickPath()resolves the clicked row viacomposedPath()(works when a shadow-DOM/web-component tree only exposesdata-*attributes), falling back toclosest('[data-type="item"]'). Wired through anonClickCapturehandler on the scroll container.resolveFilePath()normalizes leading/trailing slashes against the knownfilePathsset;resolvedSelectedPathmemo keeps the controlled/selected path canonical.handleTreeSelect+selectFileRefkeep the select callback referentially stable while always running the latest path-validation and dirty-guard logic — fixes renderers that capture their initialonSelectand reuse it after re-render.Directory + invalid-path handling (
fix(vault): ignore directory selections)data-item-type === 'file'; directory clicks are ignored.selectedPaththat doesn't resolve to a file is cleared (commitPath(null)) instead of being read as a file.Read-error surfacing
ReadErrorStatecomponent (message + Retry), backed byreadError/reloadNoncestate. Read failures now show a distinct error UI rather than collapsing into the "Open a vault document" empty state.Tests
Adds
tests/vault/vault-pane.test.tscases covering: shadow-DOM row clicks via data attributes, renderers reusing a stale selection callback, ignoring directory selections, clearing a non-file controlled path, and read-failure surfacing + retry recovery.Notes
src/vault/VaultPane.tsx(+ tests). Uses existing theme tokens (border-border,text-foreground,hover:bg-muted, …).🤖 Generated with Claude Code