Skip to content

CommentStore

Defined in: comments/store.ts:61

new CommentStore(options?): CommentStore;

Defined in: comments/store.ts:73

ParameterType
optionsCommentStoreOptions

CommentStore

PropertyModifierTypeDefined in
actorreadonlystringcomments/store.ts:62
addComment(threadId, input): string;

Defined in: comments/store.ts:115

Append a reply to an existing thread. Returns the new comment id.

ParameterType
threadIdstring
inputAddCommentInput

string


createThread(input): {
commentId: string;
threadId: string;
};

Defined in: comments/store.ts:98

Open a new thread with its first comment. Returns the ids so the caller can stamp the matching commentMark onto the document range.

ParameterType
inputCreateThreadInput
{
commentId: string;
threadId: string;
}
commentId: string;
threadId: string;

deleteComment(commentId): void;

Defined in: comments/store.ts:133

ParameterType
commentIdstring

void


deleteThread(threadId): void;

Defined in: comments/store.ts:145

ParameterType
threadIdstring

void


editComment(commentId, body): void;

Defined in: comments/store.ts:129

ParameterType
commentIdstring
bodystring

void


getThread(threadId):
| CommentThread
| undefined;

Defined in: comments/store.ts:85

ParameterType
threadIdstring

| CommentThread | undefined


ingest(events): void;

Defined in: comments/store.ts:159

Merge remote events. Idempotent (dedupes by event id) and echo-free (does NOT notify onLocalEvents). Notifies UI subscribers if anything actually changed.

ParameterType
eventsreadonly CommentEvent[]

void


onLocalEvents(listener): Unsubscribe;

Defined in: comments/store.ts:179

Subscribe to locally authored events only (for fan-out by CommentSync). Remote events ingested via ingest do NOT fire this — prevents echo loops.

ParameterType
listener(events) => void

Unsubscribe


openThreadIds(): Set<string>;

Defined in: comments/store.ts:90

Thread ids that currently have at least one visible (non-deleted) comment.

Set<string>


reopenThread(threadId, by?): void;

Defined in: comments/store.ts:141

ParameterType
threadIdstring
by?CommentAuthor

void


resolveThread(threadId, by?): void;

Defined in: comments/store.ts:137

ParameterType
threadIdstring
by?CommentAuthor

void


snapshot(): CommentEvent[];

Defined in: comments/store.ts:152

The full event log — send to a freshly-joined peer.

CommentEvent[]


subscribe(listener): Unsubscribe;

Defined in: comments/store.ts:172

Subscribe to materialized-state changes (for UI re-render).

ParameterType
listener() => void

Unsubscribe


threads(): CommentThread[];

Defined in: comments/store.ts:80

All non-deleted threads, newest first.

CommentThread[]