Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an owner decision: an engineering owner needs to provide or identify the governing spec for the new typingIndicator slot on Comments and CommentThread, because no current spec covers it. What must be settled is the slot itself, the change that leaves typing hidden unless a product passes the slot, and the typing row's alignment with the avatar column, including whether the slot receives the avatar-column width. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Independent of that decision, these are needed before approval:
- The typing accessibility text in
Comments.doc.mjs(line 136) tells every indicator to announce who is typing, but in the default layout the threads sit in a politerole="log"that already speaks the indicator's text, so an indicator built from this guidance is heard twice; say that inside the log the indicator must not announce again, and that withlayout="embedded"it announces once per change, politely, asChatTypingIndicatordoes. - The description needs the first-load gzip size delta, base against head, for a page that renders
CommentswithouttypingIndicator, which the optional-feature size rule requires.
Two smaller doc points: the live-state guidance in both components' docs still says to map typingUsers without naming typingIndicator, and the showcase block's componentsUsed omits ChatTypingIndicator.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: Comments drew typing with Lab's
ChatTypingIndicator: verified, the baseCommentRow.tsximported and rendered it. - Claim:
typingIndicatorfollows theemojiPickerrender-function shape: verified,types.ts:315and:321. - Claim: for an open thread, Comments calls it with each typing person once and without the viewer, at the end of the thread: verified,
CommentRow.tsx:396-398and:804-811. - Claim:
CommentTypingIndicatorRenderPropsnames what the function receives: verified,types.ts:253-257, exported from the family index and the Lab root. - Claim: the family no longer imports
ChatTypingIndicator: verified; only the doc example string names it. - Claim: no spec decides a typing slot: verified, no current record covers it.
- Claim: the contributor API guide allows a render function when the parent provides data: verified (
docs/contributing/api-conventions.md), but that guide is not a spec. - Claim: without
typingIndicator, typing shows nothing: verified,CommentRow.tsx:806and the new test. - Claim: Comments set a private width so the dots sat in the avatar column, and now they start at the row's edge: verified from code, not from rendered frames.
- Claim: the docs say the indicator announces once per change, politely: verified as written, but wrong inside the default threads log (finding above).
- Claim: the tests check
[Maya Chen, Release Assistant]from a list with the viewer and a duplicate, and no row without the prop: verified by readingComments.test.tsx:579-623; not run. - Claim: the Comments tests pass, the Lab typecheck passes, and pre-review, lint and formatting checks are clean: unverified; they were not run for this review and CI has not run them on this head.
- Claim: the branch sits on a recent main commit and applied without conflicts: verified, its merge base with main is that commit.
- Claim: public text carries no internal context: verified for the added lines, title, body, branch name and commit message.
- Claim (commit message): the docs, the Live state story and the panel showcase pass
ChatTypingIndicator: verified. - File
apps/storybook/stories/Comments.stories.tsx: clear. - File
packages/lab/blocks/CommentsShowcase.tsx: clear; its doc'scomponentsUsedis the note above. - File
packages/lab/src/Comments/CommentRow.tsx: clear. - File
packages/lab/src/Comments/CommentThread.doc.mjs: note, the guidance at line 81 does not name the prop. - File
packages/lab/src/Comments/CommentThread.tsx: clear. - File
packages/lab/src/Comments/Comments.doc.mjs: finding at line 136, and a note at line 111. - File
packages/lab/src/Comments/Comments.test.tsx: clear. - File
packages/lab/src/Comments/Comments.tsx: clear. - File
packages/lab/src/Comments/CommentsContext.tsx: clear. - File
packages/lab/src/Comments/index.ts: clear. - File
packages/lab/src/Comments/types.ts: clear. - File
packages/lab/src/index.ts: clear.
a91d4d6 to
2513fb7
Compare
1aaf784 to
4e4e565
Compare
|
The typing accessibility text in the Comments docs now uses the suggested wording: inside the threads log, the log announces the indicator's text, so the indicator must not announce it again; with
The slot itself waits for the owner's decision. |
There was a problem hiding this comment.
Approval waits on an owner decision: no current spec covers the new typingIndicator slot on Comments and CommentThread, so an engineering owner needs to provide or identify the governing spec for the slot, for the change that hides typing unless a product passes it, and for the typing row's alignment with the avatar column, including whether the slot receives the column width. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Also needed before approval:
- Miss: desktop behavior change needs an owner decision: with default props, an open thread no longer shows the animated typing row for mouse and trackpad users (
CommentRow.tsx:802-809), so gate the change to touch input or cite the owner's decision for it.
The earlier accessibility-text, first-load size and doc points are fixed; one small doc gap remains, since the CommentThread docs never say how a passed typing indicator announces, although a standalone thread has no log.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- The slot is a render function shaped like the
emojiPickerslot: verified (types.ts:315,:321). - Comments calls it for an open thread with each typing person once and without the viewer, at the end of the thread: verified (
CommentRow.tsx:394-396,:802-809). - The new
CommentTypingIndicatorRenderPropstype names what it receives and is exported: verified (types.ts:253-257,Comments/index.ts:36,lab/src/index.ts:77). - The family no longer imports
ChatTypingIndicator: verified (only the doc example names it). - No spec decides a typing slot: verified (no current spec names it).
- The API conventions guide allows a render function when the parent must provide data: verified, though the guide sets no policy.
- Without the slot typing shows nothing, where Comments always drew the indicator before: verified (base
CommentRow.tsx; the new test). - The dots move from the avatar column to the row's edge: verified from code (the private width override is gone).
- The docs tell the indicator to stay silent inside the threads log and to announce once per change when embedded, and the live-state guidance names the prop: verified (
Comments.doc.mjs:111,:136;CommentThread.doc.mjs:81,:395,:509). - A page without the slot loads 0.9 KB (panel) and 0.6 KB (thread) less gzip: direction verified from the import graph; the numbers were not re-measured.
- The panel showcase passes the indicator and lists it in
componentsUsed: verified (CommentsShowcase.tsx:320-322,CommentsShowcase.doc.mjs:14). - The test feeds the viewer, Maya twice and the agent, and the function receives Maya and the agent: verified (
Comments.test.tsx:579-610). - Without the slot there is no typing row: verified (
Comments.test.tsx:612-623). - The Lab tests, typecheck, lint and browser runs pass: not verified here; no CI workflow ran on this head.
- Stacked on the Comments API pass, with unrelated fixes split out: verified; the only tagalong is a header-comment accuracy fix.
Files:
packages/lab/src/Comments/CommentRow.tsx: desktop behavior finding.packages/lab/src/Comments/CommentThread.doc.mjs: non-blocking doc gap (no typing accessibility row).packages/lab/src/Comments/Comments.doc.mjs: clear.packages/lab/src/Comments/types.ts: clear.packages/lab/src/Comments/CommentsContext.tsx: clear.packages/lab/src/Comments/Comments.tsx: clear.packages/lab/src/Comments/CommentThread.tsx: clear.packages/lab/src/Comments/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/Comments.test.tsx: clear.packages/lab/blocks/CommentsShowcase.tsx: clear.packages/lab/blocks/CommentsShowcase.doc.mjs: clear.apps/storybook/stories/Comments.stories.tsx: clear.
| {depth === 0 && | ||
| isThreadSelected && | ||
| typingIndicator != null && | ||
| typingUsers.length > 0 && ( | ||
| <HStack width="100%" data-thread-typing-indicator="true"> | ||
| {typingIndicator({users: typingUsers})} | ||
| </HStack> | ||
| )} |
There was a problem hiding this comment.
Desktop behavior change needs an owner decision: with default props, an open thread whose typingUsers name someone besides the viewer no longer shows the animated typing row for mouse and trackpad users, since the row now renders only when typingIndicator is passed. Gate the change to touch input, or cite the owner's decision for removing the default row.
2513fb7 to
1397124
Compare
4e4e565 to
a43854e
Compare
|
The default change is now in the description as an item for the spec owner's The CommentThread docs gain a typing accessibility row, in English, Chinese and the dense text: a standalone thread has no log, so a passed indicator says who is typing once per change, politely, unless the page puts the thread inside a live region that already speaks it. The draft CommentThread record that comes with the move says the same. |
There was a problem hiding this comment.
Approval waits on an owner decision, and two code fixes are needed either way.
No current spec covers the new typingIndicator slot on Comments and CommentThread: an engineering owner needs to provide or identify the governing spec for the slot, for hiding typing unless a product passes it, and for the typing row's alignment with the avatar column, including whether the slot receives the column width. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Blocking findings:
- Desktop behavior change needs an owner decision: with default props, an open thread no longer shows the animated typing row for mouse and trackpad users (
CommentRow.tsx:802-809), so gate the change to touch input or cite the owner's decision for it. - Miss:
CommentRow.tsx:807callstypingIndicatoras a plain function during its own render, so a function component with hooks passed astypingIndicator={MyIndicator}crashes the thread with "Rendered more hooks than during the previous render" when typing starts (reproduced locally); render the slot through a small stable component instead and add a test for it. - Miss: the spec's rule that every function-valued component prop is named
render<X>(the caller-rendered trigger spec, DEC-6) makes this proprenderTypingIndicator(types.ts:322), and it means the slot's name is not one of the open questions.
The new typing accessibility row in the CommentThread docs closes the earlier doc gap.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
changed rules (12): Complete pass before approval; Claim evidence must reach the case; A claim about all, every; A negative claim that names; A claim backed by a test; A claim that cites code lines; Any exception found to a claim; Reported evidence is not; Claim bounding in one round; A claim bounded by a record; The rules above still apply; When the issued head equals
Claims:
- Title: a
typingIndicatorrender prop shows who is typing: verified (CommentRow.tsx:802-809; test atComments.test.tsx:579-610, run locally). - The slot is a render function shaped like
emojiPicker: verified (types.ts:316,:322). - It is called for an open thread with each typing person once and without the viewer, after the last reply: verified (
CommentRow.tsx:276-285,:394-397,:802-809; the test feeds viewer, Maya twice and the agent and asserts the last call gets Maya and the agent, run locally). - The new render-props type names what it receives and is exported: verified (
types.ts:253-257,Comments/index.ts:36,lab/src/index.ts:77). - The family no longer imports the typing indicator: verified (the import graph of
Comments.tsxandCommentThread.tsxreaches 15 files, none underChat/; a text search of the Comments folder finds the name only in a doc example). - No spec decides the slot's name and shape: false for the name (DEC-6 above); true for the slot and its default.
- The
emojiPickershape is the one the spec owner suggested: unverified; the base pull request's discussion still shows its name awaiting the owner. - The API conventions guide allows a render function when the parent provides data: verified; the guide says it creates no policy.
- Without the slot typing shows nothing for any input, where Comments drew the indicator before: verified (test at
Comments.test.tsx:612-623, run locally; base and head browser captures). - An input-type gate would not fit because the cause is the import boundary: consistent with the code, which has no input condition.
- The dots move from the avatar column to the row's edge: verified (captures: the dots column narrows from 28px to 19px and the label moves 9px left).
- The docs tell the indicator not to announce inside the threads log and to announce once per change, politely, with
layout="embedded": verified (Comments.doc.mjs:136;ChatTypingIndicator.tsx:192-199does so). - The live-state guidance in both components' docs names the prop: verified (
Comments.doc.mjs:111;CommentThread.doc.mjs:81,:402,:523). - The CommentThread docs gain a typing accessibility row in English, Chinese and dense text: verified (
CommentThread.doc.mjs:114-120,:435-441,:556-562). - First-load size without the slot drops by 0.9 KB (panel) and 0.6 KB (thread): reported; the direction matches the import graph.
- The import-boundaries check sizes Core entries only: verified (every entry module in
scripts/check-component-import-boundaries.mjsis underpackages/core/src). - The showcase passes the indicator and lists it in
componentsUsed: verified (CommentsShowcase.tsx:320-322,CommentsShowcase.doc.mjs:14). - The Comments tests pass (104): verified, 104 passed locally.
- Typecheck and the pre-review checklist pass: reported; prettier and eslint on the changed files are clean locally.
- Validated on main with the pull requests below: reported.
- One capability; unrelated fixes split; no internal context in public text: verified (the header edit sits in the header sentence the change rewrites; no internal references found).
Files:
packages/lab/src/Comments/CommentRow.tsx: desktop behavior and inline-call crash findings.packages/lab/src/Comments/types.ts: DEC-6 name finding.packages/lab/src/Comments/CommentsContext.tsx: clear (follows the rename).packages/lab/src/Comments/Comments.tsx: clear (follows the rename).packages/lab/src/Comments/CommentThread.tsx: clear (follows the rename).packages/lab/src/Comments/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/Comments.doc.mjs: clear (follows the rename).packages/lab/src/Comments/CommentThread.doc.mjs: clear (follows the rename).packages/lab/src/Comments/Comments.test.tsx: clear; a hook-component case belongs with the crash fix.packages/lab/blocks/CommentsShowcase.tsx: clear (follows the rename).packages/lab/blocks/CommentsShowcase.doc.mjs: clear.apps/storybook/stories/Comments.stories.tsx: clear (follows the rename).
Comments drew typing state with Lab's ChatTypingIndicator, so Comments and CommentThread imported a component that stays in Lab. `typingIndicator` now renders it: while an open thread's `typingUsers` name someone besides the viewer, Comments passes those people, each once, and places what the function returns at the end of the thread. It follows `emojiPicker`'s shape. Without it, typing shows nothing. The new `CommentTypingIndicatorRenderProps` type names what the function receives. Docs, the Live state story, and the panel showcase pass ChatTypingIndicator.
1397124 to
af30358
Compare
a43854e to
a071479
Compare
|
Rebased onto Repeated on this head: |
There was a problem hiding this comment.
Approval waits on an owner decision, and two code fixes are needed either way.
No current spec covers the new typingIndicator slot on Comments and CommentThread: an engineering owner needs to provide or identify the governing spec for the slot, for hiding typing unless a product passes it, and for the typing row's alignment with the avatar column, including whether the slot receives the column width. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Blocking findings:
- Desktop behavior change needs an owner decision: with default props, an open thread no longer shows the animated typing row for mouse and trackpad users (
CommentRow.tsx:802-809), so gate the change to touch input or cite the owner's decision for it. - Miss:
CommentRow.tsx:807callstypingIndicatoras a plain function during its own render, so a function component with hooks passed astypingIndicator={MyIndicator}crashes the thread with "Rendered more hooks than during the previous render" when typing starts (reproduced locally on this head); render the slot through a small stable component instead and add a test for it. - Miss: the spec's rule that every function-valued component prop is named
render<X>(the caller-rendered trigger spec, DEC-6) makes this proprenderTypingIndicator(types.ts:322), and it means the slot's name is not one of the open questions.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
Claims:
- Title: a
typingIndicatorrender prop shows who is typing: verified (CommentRow.tsx:802-809; test atComments.test.tsx:578-609, run locally). - The slot is a render function shaped like
emojiPicker: verified (types.ts:316,:322). - It is called for an open thread with each typing person once and without the viewer, and its result is placed at the end of the thread: verified (
CommentRow.tsx:276-285,:394-396,:802-809: after the last reply, with the reply composer below it when open; the test feeds viewer, Maya twice and the agent and asserts the last call gets Maya and the agent, run locally). - The new render-props type names what it receives and is exported: verified (
types.ts:253-257,Comments/index.ts:36,lab/src/index.ts:77). - The family no longer imports the typing indicator: verified (a text search of the Comments folder finds the name only in a doc example string, and no Comments module imports anything from Lab's Chat folder, directly or through its two shared Lab helpers).
- No spec decides the slot's name and shape: false for the name (DEC-6 above); true for the slot and its default.
- The
emojiPickershape is the one the spec owner suggested: unverified; the base pull request's discussion still shows its name awaiting the owner. - The API conventions guide allows a render function when the parent provides data: verified.
- Without the slot typing shows nothing for any input, where Comments drew the indicator before: verified (test at
Comments.test.tsx:611-622, run locally; base and head browser captures). - An input-type gate would not fit because the cause is the import boundary: consistent with the code, which has no input condition.
- The dots move from the avatar column to the row's edge: verified (captures: the dots column narrows from 28px to 19px and the label moves 9px left).
- The docs tell the indicator not to announce inside the threads log and to announce once per change, politely, with
layout="embedded": verified (Comments.doc.mjs:136; the default layout renders a log and the embedded one does not,Comments.tsx:193,:611-649). - The live-state guidance in both components' docs names the prop: verified (
Comments.doc.mjs:111;CommentThread.doc.mjs:81,:402,:523). - The CommentThread docs gain a typing accessibility row in English, Chinese and dense text: verified (
CommentThread.doc.mjs:114-120,:435-441,:556-562). - First-load size without the slot drops by 0.9 KB (panel) and 0.6 KB (thread): reported; the direction matches the import graph.
- The import-boundaries check sizes Core entries only: verified (every entry module in
scripts/check-component-import-boundaries.mjsis underpackages/core/src). - The showcase passes the indicator and lists it in
componentsUsed: verified (CommentsShowcase.tsx:320-322,CommentsShowcase.doc.mjs:14). - The Comments tests pass (105): verified, 105 passed locally.
- Lab build, typecheck and the pre-review checklist pass: reported; prettier and eslint on the changed files are clean locally.
- Rebased onto main with the pull requests below, with this pull request's own diff unchanged: verified (the patch matches the pre-rebase patch apart from two hunk offsets).
- One capability; unrelated fixes split; consumer docs and focused tests ship; no internal context in public text: verified (the header edit sits in the header sentence the change rewrites; no internal references found).
Files:
packages/lab/src/Comments/CommentRow.tsx: desktop behavior and inline-call crash findings.packages/lab/src/Comments/types.ts: DEC-6 name finding.packages/lab/src/Comments/CommentsContext.tsx: clear (follows the rename).packages/lab/src/Comments/Comments.tsx: clear (follows the rename).packages/lab/src/Comments/CommentThread.tsx: clear (follows the rename).packages/lab/src/Comments/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/Comments.doc.mjs: clear (follows the rename).packages/lab/src/Comments/CommentThread.doc.mjs: clear (follows the rename).packages/lab/src/Comments/Comments.test.tsx: clear; a hook-component case belongs with the crash fix.packages/lab/blocks/CommentsShowcase.tsx: clear (follows the rename).packages/lab/blocks/CommentsShowcase.doc.mjs: clear.apps/storybook/stories/Comments.stories.tsx: clear (follows the rename).
…renders as its own component
A public component prop whose value is a function that returns rendered
output is named render<X> (spec:AST-055 DEC-6), so `typingIndicator`
becomes `renderTypingIndicator` on Comments and CommentThread, with their
docs, the Live state story, the panel showcase, and the tests.
The row called the indicator function inside its own render, and only while
someone typed. An indicator component that calls hooks then changed the
row's hook count when typing started or stopped, and the thread crashed
("Rendered more hooks than during the previous render"). The indicator now
renders through a small component, so its hooks run in their own fiber.
|
Both code fixes are in, on top of #13740's new head:
The head is a merge of #13740's new head (the On this head: 107 Comments tests pass. The Core build, the Lab build and The desktop default (no typing row without the slot) stays in the description as an item for the spec owner's |
There was a problem hiding this comment.
Approval waits on an owner decision, and one code change is needed either way.
No current spec covers the new renderTypingIndicator slot on Comments and CommentThread: an engineering owner needs to provide or identify the governing spec for the slot, for hiding typing unless a product passes it, and for the typing row's alignment with the avatar column, including whether the slot receives the column width. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Blocking findings:
- Desktop behavior change needs an owner decision: with default props, an open thread no longer shows the animated typing row for mouse and trackpad users (
CommentRow.tsx:814-824), so gate the change to touch input or cite the owner's decision for it. TypingIndicatorSlot(CommentRow.tsx:82-91) repeats the base'sEmojiPickerSlot(CommentComposer.tsx:89-98), so make one shared render-slot helper for the family, use it in both places, and delete the two private copies.
The earlier hook crash and the render<X> naming are fixed: the hook-component test passes locally and fails locally when the slot is called inline again.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title: a
renderTypingIndicatorrender prop shows who is typing: verified (CommentRow.tsx:814-824; test atComments.test.tsx:578-609, run locally). - The slot is a render function in the same shape as
renderEmojiPicker: verified (types.ts:316,:322-324). - For an open thread it receives the typing people besides the viewer, each once, and its result is placed at the end of the thread: verified (
CommentRow.tsx:288-297,:406-408,:814-824: after the last reply, with the reply composer below it when open; the test feeds the viewer, Maya twice and the agent and asserts the last call gets Maya and the agent, run locally). - The new render-props type names what it receives and is exported: verified (
types.ts:253-257,Comments/index.ts:36,lab/src/index.ts:77). - The family no longer imports the typing indicator: verified (a text search of the Comments folder finds the name only in a doc example string, and no Comments module imports anything from Lab's Chat folder, directly or through its two shared Lab helpers).
- No spec decides a typing slot: verified (no current record names one; no Comments record exists).
- The
renderEmojiPickershape is the one the spec owner suggested in the API review: unverified; the base pull request's discussion does not show that suggestion. - The API conventions guide allows a render function when the parent provides data: verified.
- The slot's name follows the caller-rendered trigger spec's
render<X>rule, so it is not open: verified. - Without the slot typing shows nothing for any input, where Comments drew the indicator before: verified (test at
Comments.test.tsx:642-653, run locally; base and head browser captures). - An input-type gate would not fit because the cause is the import boundary: consistent with the code, which has no input condition.
- The dots move from the avatar column to the row's edge: verified (captures: the private column width is gone and the label moves 9px left of the comment text).
- The docs tell the indicator not to announce inside the threads log and to announce once per change, politely, with
layout="embedded": verified (Comments.doc.mjs:136; the default layout renders a log and the embedded one does not,Comments.tsx:611-651). - The live-state guidance in both components' docs names the prop: verified (
Comments.doc.mjs:111;CommentThread.doc.mjs:81,:402,:523). - Tests: the slot gets each person once without the viewer, there is no row without it, and a hook-using indicator renders as typing starts and stops, a test that fails without the fix: verified (
Comments.test.tsx:578-653, run locally; the hook test fails locally when the slot is called inline again). - First-load size without the slot drops by 0.9 KB (panel) and 0.6 KB (thread): reported; the direction matches the import graph.
- The import-boundaries check sizes Core entries only: verified (every entry in
scripts/check-component-import-boundaries.mjsis underpackages/core/src). - The showcase passes the indicator and lists it in
componentsUsed: verified (CommentsShowcase.tsx:320-322,CommentsShowcase.doc.mjs:14). - The CommentThread docs gain a typing accessibility row in English, Chinese and dense text: verified (
CommentThread.doc.mjs:114-120,:435-441,:556-562). - The Comments tests pass (107): verified, 107 passed locally.
- Core and Lab builds, typecheck, the pre-review checklist and the knowledge check pass: reported; prettier is clean and eslint shows no errors on the changed files locally.
- This head merges the base pull request's new head and adds one commit; nothing below it changed: verified (history shows one merge of the base branch and one commit).
- One capability; unrelated fixes split; consumer docs and focused tests ship; no internal context in public text: verified (the header edit sits in the header sentence the change rewrites; no internal references found).
Files:
packages/lab/src/Comments/CommentRow.tsx: desktop behavior and shared-helper findings.packages/lab/src/Comments/types.ts: clear.packages/lab/src/Comments/CommentsContext.tsx: clear.packages/lab/src/Comments/Comments.tsx: clear.packages/lab/src/Comments/CommentThread.tsx: clear.packages/lab/src/Comments/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/Comments.doc.mjs: clear.packages/lab/src/Comments/CommentThread.doc.mjs: clear.packages/lab/src/Comments/Comments.test.tsx: clear.packages/lab/blocks/CommentsShowcase.tsx: clear.packages/lab/blocks/CommentsShowcase.doc.mjs: clear.apps/storybook/stories/Comments.stories.tsx: clear.
| /* Its own component, so the hooks of an indicator component run in their own | ||
| fiber, not in the row's render. */ | ||
| function TypingIndicatorSlot({ | ||
| render, | ||
| users, | ||
| }: CommentTypingIndicatorRenderProps & { | ||
| render: (props: CommentTypingIndicatorRenderProps) => ReactNode; | ||
| }) { | ||
| return render({users}); | ||
| } |
There was a problem hiding this comment.
This repeats EmojiPickerSlot in CommentComposer.tsx:89-98, comment included, with other props. A later fix to how the family renders a slot, such as a caller that switches between two indicator components, would reach only one of them. Make one shared helper and use it in both places, for example:
function RenderSlot<P>({
render,
props,
}: {
render: (props: P) => ReactNode;
props: P;
}) {
return render(props);
}
// …
<RenderSlot render={renderTypingIndicator} props={{users: typingUsers}} />then delete TypingIndicatorSlot and EmojiPickerSlot.
Stacked on #13740 (the Comments API pass). Review that first; this PR's base is its branch.
User need
Comments must move to Core, and Core cannot import from Lab. Comments drew typing state with Lab's
ChatTypingIndicator, and Chat's additions stay in Lab. Products still need to show who is typing in an open thread.Problem and solution fit
renderTypingIndicatoris a render function, in the same shape as therenderEmojiPickerslot from the API pass. While an open thread'stypingUsersname someone besides the viewer, Comments calls it with those people, each once and without the viewer, and places the result at the end of the thread. The newCommentTypingIndicatorRenderPropstype names what it receives. The family no longer importsChatTypingIndicator.Current specification
No record decides a typing slot. It follows the shape of the
renderEmojiPickerslot the spec owner suggested in the API review: a render function that takes what the parent provides.docs/contributing/api-conventions.mdallows a render function when the parent must provide data, here the deduplicated typing people.The slot's name is not open:
spec:AST-055(caller-rendered triggers) DEC-6, a current record, names every function-valued component proprender<X>, so the slot isrenderTypingIndicator, like the family'srenderBodyandrenderComposer.The spec owner's
/approve-specwould settle three things no record decides:renderTypingIndicator. The change comes from Core not importing Lab's indicator, not from the input, so a gate on the input type would not fit.Public delta and caller burden
renderTypingIndicator?: (props: {users: readonly CommentUser[]}) => ReactNode, and theCommentTypingIndicatorRenderPropstype.renderTypingIndicator, typing shows nothing. Before, Comments always drew Lab's indicator.The new caller decision: which indicator to pass, if any. Inside the threads log (the default layout), the log announces the indicator's text, so the docs tell the indicator not to announce it again. With
layout="embedded", which has no log, the indicator says who is typing once per change, politely. The live-state guidance in both components' docs namesrenderTypingIndicator.Design and alternatives
renderEmojiPicker. Core stays free of Lab, and a product can use any indicator.ChatTypingIndicatorto Core with the family. Rejected: Chat's additions stay in Lab.Open for the owner: should Comments pass the avatar-column width to the slot, so an indicator can align its dots with the avatars as before?
Evidence
The Live state story. Before: the Comments fixes below this PR, where Comments draws Lab's indicator; the API pass does not change this row. After: this branch, where the story passes
ChatTypingIndicatorthrough the slot.Tests:
renderTypingIndicatorrenders once the thread opens, with each person once and without the viewer: the function receives[Maya Chen, Release Assistant]from[viewer, Maya, Maya, agent].renderTypingIndicator, there is no typing row.renderTypingIndicator={MyIndicator}, renders as typing starts and stops. Before, the row called the function inside its own render and the thread crashed ("Rendered more hooks than during the previous render"); the indicator now renders through a small component. The new test fails without the fix.First-load size (
architecture:component-import-boundariesINV10: an optional feature costs nothing where it is unused). A page that renders the Comments panel withoutrenderTypingIndicator: 380.9 KB → 380.0 KB gzip (−0.9 KB); CommentThread: 373.8 KB → 373.2 KB (−0.6 KB). ChatTypingIndicator leaves the eager graph. Measured base against head with the size report's build options (minified ESM, code splitting, React and StyleX external), counting the eager graph only.pnpm check:component-import-boundariessizes Core entries only, so it does not cover these Lab components.The panel showcase passes ChatTypingIndicator through the slot and names it in
componentsUsed.The CommentThread docs gain a typing accessibility row, in English, Chinese, and the dense text: a standalone thread has no log, so a passed indicator says who is typing once per change, politely, unless the page puts the thread inside a live region that already speaks it.
Scope
Components: Comments, CommentThread
Testing
Repeated on this head:
vitest run packages/lab/src/Comments: 107 tests pass. Core build, Lab build, andpnpm typecheck(Lab and Lab docs): pass.ASTRYX_STRICT_LINT=1 eslintandprettier --checkon the changed files: clean.pnpm review:preagainst refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji #13740's new head: 0 findings.pnpm check:knowledge: clean.tscfor Lab and Lab docs, after a Lab build: pass.pnpm review:pre: 0 findings.eslintandprettieron the changed files: clean.Real Chromium (Playwright) on static Storybook builds, scoped to
#storybook-root.This head merges refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji #13740's new head (the
renderEmojiPickerrename and its slot fix) and adds one commit with this pull request's rename and slot fix. Nothing below refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji #13740 changed.