s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← All packages
Content & media v0.57.40 New

@happyvertical/smrt-comments

Tenant-scoped comments on any record, mention notification composition, and a browser-safe RecordComments component.

Source ↗

What it gives you

Tenant-scoped comments on any record, mention notification composition, and a browser-safe RecordComments component.

  1. 01Comments attach to arbitrary records through a qualified polymorphic metaType and metaId pair
  2. 02CommentService requires a trusted actor and a host authorizeRecord callback on both create and listForRecord
  3. 03No runtime dependency on smrt-messages: the host composes mention notifications through a structural interface

Mentions and delivery

Mentions are UUIDs, deduplicated, limited to 50; self-mentions do not notify. Validation finishes before the single insert, so an invalid mention leaves no row. The comment is saved before delivery; a delivery rejection leaves it saved, and the retry is delivery, not create.

The component owns nothing but the view

RecordComments takes authorized comment projections, an onsubmit callback, and a contextKey naming tenant, actor, and record. Changing the key clears drafts and ignores stale submissions. The host owns loading, authentication, mention selection, and refresh. The comments.records recipe has no global navigation: a discussion needs an already-authorized parent record.