fix(memory-workspace): toast + Reveal Folder fallback for View Vault (#2281)#2289
Conversation
Wrap tauri-plugin-opener's revealItemInDir so callers can drive a guaranteed-works folder reveal in the host OS (Finder, Explorer, xdg-open) when a third-party deep link (e.g. obsidian://) may silently no-op because the target app isn't installed. Capability allowlist adds opener:allow-reveal-item-in-dir.
…inyhumansai#2281) Clicking View Vault used to call openUrl('obsidian://...') and rely entirely on the OS to launch Obsidian. When Obsidian isn't installed the shell silently accepts the URL and does nothing, so the button feels broken. Surface a toast on every click that names the vault path AND offers a Reveal Folder action that opens the vault directory in the host file manager via the new revealPath helper. Error path swaps the info toast for an error toast with the same fallback. Closes tinyhumansai#2281.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughThis PR implements the "View Vault" button in Memory tree UI by adding Obsidian vault opening with comprehensive error handling and a fallback reveal action. It introduces a new ChangesView Vault Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
graycyrus
left a comment
There was a problem hiding this comment.
Nice fix for #2281 — the toast + Reveal Folder fallback is a solid UX upgrade for users without Obsidian. Tests cover all four branches cleanly, capability is correctly scoped, and the i18n fallback strategy is pragmatic.
One minor type nit below, otherwise LGTM.
| */ | ||
| async function openVaultInObsidian(contentRootAbs: string): Promise<void> { | ||
| async function openVaultInObsidian(contentRootAbs: string): Promise<unknown | null> { | ||
| const url = `obsidian://open?path=${encodeURIComponent(contentRootAbs)}`; |
There was a problem hiding this comment.
[minor] Promise<unknown | null> simplifies to Promise<unknown> — null is already a member of unknown, so the | null is a no-op and makes it look like the return could be unknown OR null as distinct cases (which is the intent, but the type doesn't express it).
Suggestion: either Promise<unknown> with a doc comment explaining the null-means-success convention, or a small discriminated type:
type VaultOpenResult = { ok: true } | { ok: false; error: unknown };|
huge thanks @obchain, the toast plus reveal folder fallback is such a nice touch for folks without obsidian 🙌 love how the vault path shows up right in the toast too, makes view vault feel way more reliable. thanks for shipping this one ✨ |
Summary
revealPathhelper (wrapstauri-plugin-opener'srevealItemInDir) +opener:allow-reveal-item-in-dircapability so the renderer can drive a Finder/Explorer reveal.Problem
MemoryWorkspace.tsxView Vault sentobsidian://open?path=...throughopenUrland relied on the host OS to launch Obsidian. When Obsidian is not installed, the OS shell (LaunchServices on macOS, xdg-open on Linux, ShellExecute on Windows) accepts the URL handoff but launches nothing. No toast, no error, no fallback — the button looks broken to non-technical users.Solution
revealPath(path)helper inapp/src/utils/openUrl.tswrapsrevealItemInDirfrom@tauri-apps/plugin-opener. No-op outside Tauri.app/src-tauri/capabilities/default.jsonaddsopener:allow-reveal-item-in-dir.MemoryWorkspace.tsxreplaces the silent module helper with ahandleViewVaultcallback. On click:openUrl(obsidian://...).infotoast that names the vault path and exposes a Reveal Folder action.errortoast with the same Reveal Folder action.revealPath(content_root_abs); if that fails too, surface a final error toast with the underlying message.workspace.openingVault*,workspace.openVaultFailed*,workspace.revealFolder,workspace.revealVaultFailed) added toen.ts+en-3.ts, with English fallback into all 11 non-en-3chunks sopnpm i18n:checkexits 0.Submission Checklist
MemoryWorkspace.test.tsxandopenUrl.test.ts.handleViewVaultandrevealPathhas a dedicated test.## Related— N/A: no matrix row affected.Closes #NNNin the## Relatedsection.Impact
revealItemInDirIPC call.obsidian://deep-link behaviour preserved for users with Obsidian installed.Related
i18n:checkpasses).AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/2281-view-vault-no-feedbackValidation Run
pnpm --filter openhuman-app format:checkpnpm typecheckpnpm test src/utils/openUrl.test.ts src/components/intelligence/__tests__/MemoryWorkspace.test.tsx(23/23 pass); fullpnpm test(2880 pass, 3 skipped).Validation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
Parity Contract
obsidian://deep link still dispatched first; users with Obsidian installed see Obsidian launch as before.openUrlreject path still propagates non-http scheme errors; new error branch inhandleViewVaultsurfaces those as user-facing toasts.Duplicate / Superseded PR Handling
Summary by CodeRabbit
New Features
Documentation