fix: enable linked doc navigation in annotate mode#276
Merged
backnotprop merged 1 commit intobacknotprop:mainfrom Mar 12, 2026
Merged
fix: enable linked doc navigation in annotate mode#276backnotprop merged 1 commit intobacknotprop:mainfrom
backnotprop merged 1 commit intobacknotprop:mainfrom
Conversation
The annotate server was missing the /api/doc endpoint, so clicking .md links (e.g., [see other](sibling.md)) in annotated files showed "Failed to connect to server" — the request fell through to the SPA catch-all and returned HTML instead of JSON. Three changes: 1. annotate.ts — Add /api/doc route, auto-injecting the source file's parent directory as ?base= so relative links resolve from the correct location. 2. reference-handlers.ts — handleDoc() now accepts an optional ?base= query param and tries resolving relative paths against it before falling back to the project-root glob search. 3. App.tsx — handleOpenLinkedDoc passes the current file's directory as ?base= when navigating linked-doc → linked-doc, so chained relative links resolve correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Code reviewFound 1 issue:
plannotator/packages/editor/App.tsx Lines 508 to 521 in 0477ae3 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
4aa71a9 to
0477ae3
Compare
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
.mdlinks in annotated files (e.g.,[37% IQM](comparison_iqm_37.md)) showed "Failed to connect to server" because the annotate server had no/api/docendpoint — requests fell through to the SPA catch-all, returning HTML instead of JSON./api/dochandler (handleDoc) was only registered in the plan server (packages/server/index.ts), not the annotate server (packages/server/annotate.ts).annotate.ts— Add/api/docroute, auto-injecting the source file's parent directory as?base=so relative sibling links (e.g.,comparison_iqm_37.mdfromplots/gamma_segments/comparison_iqm_35.md) resolve from the correct locationreference-handlers.ts—handleDoc()now accepts an optional?base=query param and tries resolving relative to it before falling back to the project-root glob searchApp.tsx—handleOpenLinkedDocpasses the current file's directory as?base=when navigating linked-doc → linked-doc, so chained relative links also resolve correctlyTest plan
plannotator annotatea markdown file that contains relative.mdlinks to sibling files.mdlink — linked doc should load in-place with back button.mdlink — should resolve relative to that doc's directory🤖 Generated with Claude Code