feat: add wiki-link hover previews#756
Conversation
WalkthroughThe change adds side-effect-free existing-note resolution with unavailable outcomes, desktop wiki-link hover previews, inert markdown rendering, touch-surface gating, navigation handling, file-change readiness, and raster-only asset preview enforcement. ChangesWiki-link preview flow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant NotePane
participant NoteEditor
participant WikilinkHoverCard
participant WikiLinkHoverPreview
participant ReflectCore
User->>NotePane: hover wiki link
NotePane->>NoteEditor: provide hover renderer on non-touch surface
NoteEditor->>WikilinkHoverCard: mount renderer
WikilinkHoverCard->>WikiLinkHoverPreview: provide target and dismiss
WikiLinkHoverPreview->>ReflectCore: resolve and read existing note
ReflectCore-->>WikiLinkHoverPreview: generation-pinned note content
WikiLinkHoverPreview-->>WikilinkHoverCard: render inert markdown preview
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/graph/resolve-existing-wiki-target.test.ts (1)
20-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid the unchecked
paramstype assertion.
as unknown[]is erased at runtime. Narrow the bridge payload withArray.isArraybefore passing it toquery.As per coding guidelines, “Avoid type assertions unless genuinely necessary.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/graph/resolve-existing-wiki-target.test.ts` around lines 20 - 25, Update the invoke mock’s db_query branch to validate args?.['params'] with Array.isArray before passing it to query, using an empty array when the payload is not an array; remove the unchecked as unknown[] assertion while preserving the existing SQL fallback and query result behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/desktop/src/lib/use-file-changes.ts`:
- Around line 26-28: Update the subscription lifecycle in useFileChanges so
disabling or unsubscribing invalidates readiness even when the same handler is
later re-enabled. Track a subscription epoch or equivalent generation and
require the current subscription’s subscribeFileChanges promise to resolve
before the readiness check returns true; add coverage for the handler → null →
same handler sequence.
---
Nitpick comments:
In `@packages/core/src/graph/resolve-existing-wiki-target.test.ts`:
- Around line 20-25: Update the invoke mock’s db_query branch to validate
args?.['params'] with Array.isArray before passing it to query, using an empty
array when the payload is not an array; remove the unchecked as unknown[]
assertion while preserving the existing SQL fallback and query result behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0572a91f-e205-4882-a46d-12aa60aab871
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (28)
apps/desktop/src-tauri/src/fs/asset_protocol.rsapps/desktop/src/components/note-pane.tsxapps/desktop/src/components/route-content.test.tsxapps/desktop/src/components/wiki-link-hover-preview.test.tsxapps/desktop/src/components/wiki-link-hover-preview.tsxapps/desktop/src/editor/markdown-preview.tsxapps/desktop/src/editor/note-editor.test.tsxapps/desktop/src/editor/note-editor.tsxapps/desktop/src/editor/use-editor-autocomplete.test.tsxapps/desktop/src/editor/use-editor-autocomplete.tsapps/desktop/src/editor/use-wiki-link-hover-preview.tsxapps/desktop/src/editor/use-wiki-link-navigation.test.tsxapps/desktop/src/editor/use-wiki-link-navigation.tsapps/desktop/src/lib/read-existing-note-source.test.tsapps/desktop/src/lib/read-existing-note-source.tsapps/desktop/src/lib/use-file-changes.test.tsxapps/desktop/src/lib/use-file-changes.tsdocs/contributing/editor-architecture.mddocs/porting/README.mddocs/porting/backlink-hover-previews.mdpackages/core/src/actions/backlink-target.test.tspackages/core/src/actions/backlink-target.tspackages/core/src/exports/platform.tspackages/core/src/graph/create-note.test.tspackages/core/src/graph/create-note.tspackages/core/src/graph/resolve-existing-wiki-target.test.tspackages/core/src/graph/resolve-existing-wiki-target.tspnpm-workspace.yaml
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 53932c6. Configure here.
|
implemented in #768 |

Problem
Wiki links currently require navigation to inspect their target. A hover preview needs to reuse normal date/title/alias semantics without creating missing notes, exposing editor internals, losing pending edits, or allowing preview content to trigger network requests.
What changed
350 × 200clipped bodyThe editor API is supplied by prosekit/meowdown#288. This branch pins its immutable
pkg.pr.newsnapshot until that change is released.Testing
pnpm install --frozen-lockfilepnpm checkpnpm buildpnpm --filter @reflect/core test— 94 files, 1,297 testspnpm --filter @reflect/desktop test— 219 files, 1,973 testscargo test -p reflect-open fs::asset_protocol::tests— 5 testscargo fmt --all -- --checkScope
Desktop pointer surfaces only. Task editors and touch surfaces remain unchanged; missing, ambiguous, unavailable, and failed targets show no card.
Note
Medium Risk
Touches wiki-link resolution, note creation guards, and asset serving—areas where wrong outcomes create duplicates or load unsafe preview content—but behavior is heavily tested and previews are read-only with explicit unavailable handling.
Overview
Adds passive wiki-link hover previews on pointer-capable desktop note panes (via Meowdown’s
WikilinkHoverCard, pinned to a prerelease snapshot). Touch surfaces and task editors do not get the hover renderer.The preview resolves targets with a new
resolveExistingWikiTargetpath in@reflect/core(resolved / ambiguous / unavailable / missing), refactorsresolveOrCreateNoteWithTitleto delegate to it, and uses the same resolver for link navigation and autocomplete so iCloud placeholders and transient reads cannot be mistaken for “missing” and spawn duplicate notes.WikiLinkHoverPreviewloads generation-pinned content throughreadExistingNoteSource(live open session when safe, else disk), waits onuseFileChangessubscription readiness, and uses request epochs so stale hovers, graph switches, and file watcher events cannot show wrong or deleted notes. The card is inert (interactive/renderEmbedsoff), strips frontmatter, and only allows local raster assets via?reflect-preview=raster; the Tauri asset protocol MIME-sniffs and returns 415 for non-raster preview requests.MarkdownPreviewgainsinteractiveandrenderEmbedsflags for passive rendering. Docs mark backlink hover previews as ported.Reviewed by Cursor Bugbot for commit 5de03f4. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes