Skip to content

Fix: Layout-mode notes missing from MCP JSON and Markdown copy#176

Open
panrafal wants to merge 1 commit intobenjitaylor:mainfrom
panrafal:fix/layout-notes
Open

Fix: Layout-mode notes missing from MCP JSON and Markdown copy#176
panrafal wants to merge 1 commit intobenjitaylor:mainfrom
panrafal:fix/layout-notes

Conversation

@panrafal
Copy link
Copy Markdown

Problem

When the user attached a note to a Layout-mode item (placement or rearrange), the note was visible in the overlay but dropped from both outputs:

  • Placements — the note is added via a popup that opens only after the placement is dropped. The sync effect early-exited (if (currentMap.has(p.id)) continue;) for already-synced placements, so later text edits never reached the server.
  • Rearrangessection.note was never referenced in the sync payload at all, and pure note-only edits (no rect delta) weren't triggering any update.
  • Markdown copygenerateDesignOutput / generateRearrangeOutput rendered component type, coordinates, and sizes but never the user's note.

Fix

  • Placement sync — new placementSyncedTextMap ref tracks the last-synced p.text per id; when it diverges, PATCHes comment + placement.text via updateAnnotationOnServer. Cleared alongside placementAnnotationMap on server-driven deletes and in clearAll.
  • Rearrange sync — appends the note to comment (mirroring the existing placement pattern "…— 'my note'"), triggers on note-only edits, and uses a "Note on X section" comment when nothing geometric changed. Kept the Annotation.rearrange schema unchanged for backwards compatibility — the note rides in comment, not a new field.
  • Markdown outputgenerateDesignOutput emits - Note: "…" bullets for placements with text. generateRearrangeOutput emits notes per section and now includes sections whose only change is a note.

Files

  • package/src/components/page-toolbar-css/index.tsx
  • package/src/components/design-mode/output.ts

Wire format

No breaking changes. Annotation schema untouched. Existing consumers that read the composite comment string keep working; the note is appended to it with the same — "…" convention already used for placements.

Test plan

  • Drop a placement → double-click → add a note → Copy → note appears in markdown, and GET <endpoint>/sessions/<id> shows it in comment and placement.text.
  • Drag a section → add a note → Copy → note appears in markdown; server comment includes the note.
  • Add a note without moving a section → still appears in both outputs.
  • Edit an existing note → server annotation is PATCHed (not duplicated) and reflects the new text.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

@panrafal is attempting to deploy a commit to the Benji Taylor's Projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant