backnotprop / backnotprop/plannotator
Annotation draft only persists the open document; other documents' comments are lost on reload in folder and linked-doc sessions
- Dominant language
- TypeScript
- Stars
- 8.7k
- Forks
- 649
- Avg merge
- 11h 12m
- Merged PRs (30d)
- 109
Description
Found during the v0.27.15 release QA (pre-existing, not introduced in 0.27.15, but more visible now that #1532 and #1533 make cross-document annotating routine).
**What happens.** `useAnnotationDraft` is fed only the active document's annotation list (`packages/editor/App.tsx` ~2427, `allAnnotations`). Annotations on every other document in a folder or linked-doc session live only in `useLinkedDoc`'s in-memory cache (`packages/ui/hooks/useLinkedDoc.ts` ~618). Consequences, reproduced in a real browser:
1. Navigating to a document with no annotations tombstones the persisted draft outright (the empty-set branch in `packages/ui/hooks/useAnnotationDraft.ts` ~406), so a reload after that navigation loses every comment made in the session.
2. Reloading while a linked doc is open offers only that doc's comments in **Draft Recovered**, and restoring attributes them to the plan/root document as Unanchored cards.
3. The plan's own comments are also missing from Export and share links while a linked doc is open (`getDocAnnotations` only includes the stash when `sourceFilePath` is set, which is annotate-only).
**Related, same root:** the active document's feedback is exported twice when a linked or folder document is open at submit time (gate finding G2).
**Fix direction.** Make the draft transport carry every document's annotations (keyed by path, with the root document keyed explicitly), restore per document, and stop the empty-set tombstone when other documents still hold annotations. Needs a draft schema bump with a read-side migration for existing drafts. Proposed for 0.27.16.
Evidence: release-gate reports under the QA scratch (G1/G2 traces, `s12-trace.js`, `s9-crossdoc.js`).
Contributor guide
Research direction
Trace annotation flow from packages/editor/App.tsx around line 2427 through packages/ui/hooks/useLinkedDoc.ts around line 618 and useAnnotationDraft.ts around line 406. Compare the G1/G2 browser traces and s12-trace.js or s9-crossdoc.js. Done means drafts preserve, restore, export, and share annotations for every document, including the root, without duplicate active-document feedback, with a schema migration for existing drafts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100