Skip to content

feat: comment on a passage of a note, and ask Prax with @prax - #93

Merged
praxagent merged 1 commit into
mainfrom
feat/library-comments
Oct 4, 2026
Merged

praxagent merged 1 commit into
mainfrom
feat/library-comments

Conversation

@praxagent

@praxagent praxagent commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Comment on a passage of a note, and ask Prax with @prax. Prax side: praxagent/prax#272 (stacked on prax #270). Rebased onto main after #90 merged; merges cleanly with #91 in either order (checked locally).

What changes

Comments in the note view (Space page and Library panel).

  • Select text and a Comment button appears beside it. The composer shows the passage; Ctrl/Cmd+Enter sends.
  • The threads sit under the note, with reply, resolve or reopen, and delete. There is also a comment on the whole note, and resolved threads are hidden until you ask for them.
  • Commented passages are highlighted with the CSS Custom Highlight API, which marks ranges without touching the rendered markdown. Where a browser lacks it, everything works without highlights.
  • A thread whose passage was edited away says so.

@prax. "Prax is replying…" shows until his answer arrives, by the existing library-changed nudge or, as a fallback, by polling every 4 s while he works. Comments are relayed to Prax, which stores them in the note.

MarkdownContent memoises its react-markdown components.

  • It used to build a new object on every render, which gave react-markdown new component types each time.
  • So any parent re-render rebuilt the whole rendered DOM. That dropped a selection in progress and the highlight ranges (found end to end: the highlight vanished after the first re-render), and re-mounted every chat message for nothing.
  • A new test fails on the old code.

Verification

  • NoteComments.test.tsx (9): matching a passage across paragraphs and by prefix, threads, Prax replying, a missing passage, reply and resolve, and a whole-note comment.
  • MarkdownContent.rerender.test.tsx.
  • tests/test_library_comments.py: the relay.
  • make ci green (522 after the rebase), all 145 frontend tests pass, and lint has no new warnings.
  • End to end in headless Chromium against a stand-in Prax:
    • a real mouse drag to select, then Comment, typing and Ctrl+Enter;
    • "Prax is replying…", then the reply arriving;
    • the highlight surviving re-renders, and resolving clears it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NzJXnMXFAX7Km7aDmRc6zX

Base automatically changed from feat/library-history-trash to main October 4, 2026 21:02
Select text in a note (Space page or Library panel) and a Comment button
appears; the threads sit under the note with reply, resolve/reopen and
delete, and a comment on the whole note. Commented passages are highlighted
with the CSS Custom Highlight API, which marks ranges without touching the
rendered markdown; a thread whose passage was edited away says so. @prax in a
comment or reply asks Prax: "Prax is replying…" until his answer arrives,
by the library-changed nudge or, as a fallback, polling while he works.
Comments are relayed to Prax, which stores them in the note.

MarkdownContent now memoises its react-markdown components. A new object on
every render gave react-markdown new component types, so any parent re-render
rebuilt the whole rendered DOM: it dropped a selection in progress and the
highlight ranges, and re-mounted every chat message for nothing.
@praxagent
praxagent force-pushed the feat/library-comments branch from 20af81e to d6d9cc7 Compare October 4, 2026 21:05
@praxagent
praxagent merged commit cec8cfb into main Oct 4, 2026
2 checks passed
@praxagent
praxagent deleted the feat/library-comments branch October 4, 2026 21:09
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