Skip to content

Commit f2e04ba

Browse files
committed
docs(plugin-detail): the console takes a record's discussion from the record page payload
The "Console Integration" section still showed the console reading a record's comments with `dataSource.find('sys_comment', …)`, with field names already stale. A record open now asks the discussion and the activity in its one `POST /data/{object}/{id}/page` request; the section says so, and when the console still reads `sys_comment` on its own. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSSzaZAuzM1JMwdqpC
1 parent 2369096 commit f2e04ba

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

‎content/docs/frontend/plugins/plugin-detail.mdx‎

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ declare const items: FeedItem[];
100100

101101
### Console Integration
102102

103-
In the Console app, `RecordChatterPanel` is integrated with record detail views. Comments are fetched from the `sys_comment` object using a thread ID pattern of `{objectName}:{recordId}`:
103+
In the Console app, `RecordChatterPanel` is integrated with record detail views. A record
104+
page that draws its feed when it opens takes the discussion from the one request it makes
105+
on open, `POST /api/v1/data/{object}/{id}/page` (the [record page payload](/docs/references/api/record-page)).
106+
That request asks `discussion` (the record's comment thread and those comments' reactions)
107+
and `activity` (its newest activity rows) beside the record, and the page reads neither
108+
`sys_comment` nor `sys_activity` on its own:
104109

105110
```tsx
106111
import type { DataSource, FeedItem } from '@object-ui/types';
@@ -110,26 +115,33 @@ declare const objectName: string;
110115
declare const recordId: string;
111116
declare const dataSource: DataSource;
112117

113-
// Thread ID format
114-
const threadId = `${objectName}:${recordId}`;
115-
116-
// Fetch comments — `find` resolves to a `QueryResult`, so the rows are `.data`.
117-
const comments = await dataSource.find('sys_comment', {
118-
$filter: { threadId },
119-
$orderby: 'createdAt asc',
118+
// The record page's one request; the discussion and the activity are two of its parts.
119+
const page = await dataSource.getRecordPage?.(objectName, recordId, {
120+
discussion: true,
121+
activity: { top: 200 },
120122
});
121123

122-
// Map to FeedItem[]
123-
const feedItems: FeedItem[] = comments.data.map((c) => ({
124-
id: c._id,
124+
// A part is its rows, or the refusal of the read it replaces.
125+
const discussion = page?.discussion;
126+
const comments = discussion && 'comments' in discussion ? discussion.comments : [];
127+
128+
// Map to FeedItem[]: `sys_comment` columns are snake_case.
129+
const feedItems: FeedItem[] = comments.map((c) => ({
130+
id: String(c.id),
125131
type: 'comment',
126-
actor: c.author,
132+
actor: c.author_name,
127133
body: c.body,
128-
createdAt: c.createdAt,
129-
reactions: c.reactions ?? [],
134+
createdAt: c.created_at,
130135
}));
131136
```
132137

138+
A refused part is drawn as refused and is not asked again, and the other parts stay
139+
answered: a refused reaction read leaves the comments shown without reactions. Only a feed
140+
the open did not ask for is read on its own, from `sys_comment` by its `thread_id`
141+
(`{objectName}:{recordId}`), oldest first: for example a feed on a tab the page did not
142+
open on, or any feed on a data source without `getRecordPage`. The composer's mention list
143+
(`sys_user`, 50 rows) is read when the composer is first focused, not when the record opens.
144+
133145
**Full-page detail view** renders the panel non-collapsible at the bottom:
134146

135147
```tsx

0 commit comments

Comments
 (0)