Repository navigation
refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji - #13740
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 a spec owner's decision about the names and shapes this Comments API pass settles. The review found no defect in the code.
- No current record decides the composer's render-function name
emojiPicker(the alternative isrenderEmojiPicker, which matches Core'srender…functions and the family'srenderBody), the default with no emoji button, or aloadVersionsthat answers at once. To settle them, an engineering owner comments/approve-specwith the full head commit SHA, or names the record or shape that should govern them; the author can do this only if they are an engineering owner. - Approval also waits on the first-load gzip delta the component import-boundaries rule (INV10) asks for when a pull request adds an opt-in feature: report base against head for a page that renders CommentComposer without
emojiPicker(pnpm check:component-import-boundaries --base-ref <base>prints it per entry).
Claims and files checked
Review mode: full; reason: no-earlier-review
- Verified:
emojiPickerreplaceshasEmojiPicker. The composer keeps the button, Popover, open state and focus return, andonSelectinserts the emoji and closes the Popover (CommentComposer.tsx:518-563,CommentComposer.test.tsx:255-267). - Verified: with no
emojiPickerthere is no emoji button (CommentComposer.tsx:518, and the "leaves the emoji button out without emojiPicker" test). - Verified:
CommentEmojiPickerRenderPropsnames what the function receives and is exported (types.ts:246-250,index.ts:26). - Verified:
loadVersionsmay answer at once or with a Promise,previousVersionsis gone, and an answer given at once opens with no loading state (CommentsContext.tsx:577-600,Comments.test.tsx:1091). - Verified: with no
loadVersionsthere is no history button (CommentRow.tsx:404,Comments.test.tsx:1117). - Verified: a reaction option is
{key, emoji, label?},isSelectedreplacesreactedByViewer, andDEFAULT_COMMENT_REACTIONSfollows (types.ts:48-64,types.ts:376-384). - Verified:
updatedAtandseenByleaveCommentData, nothing at the base renders them, and the docs tell products to keep such metadata beside their records (Comments.doc.mjs:111). - Verified: the four blocks pass Lab's EmojiPicker through the slot, and stories with no picker show no emoji button.
- Verified: the tests use a stand-in picker and add the at-once history and no-history-button cases.
- Verified: the API conventions guide names boolean state
is<Name>and allows a render function when the parent provides data. The guide itself creates no policy. - Verified: Core takes an element's human-readable text in
label(Button, Badge, Token, Tab), and the shared person type comes from Core's CommentPin. - Verified: the branch sits on the
mainbase the description names. - Not checked here: the 103 Vitest tests,
tsc,pnpm review:pre, eslint and prettier. - Files, all clear:
apps/storybook/stories/Comments.stories.tsx;internal/eslint-plugin-astryx/no-internal-barrel-import.baseline.json; the fourpackages/lab/blocksComments blocks; inpackages/lab/src/Comments:CommentActions.tsx,CommentComposer.doc.mjs,CommentComposer.test.tsx,CommentComposer.tsx,CommentRow.tsx,CommentThread.doc.mjs,CommentThread.test.tsx,CommentThread.tsx,Comments.doc.mjs,Comments.test.tsx,Comments.tsx,CommentsContext.tsx,i18n.ts,index.ts,types.ts;packages/lab/src/EmojiPicker/EmojiPicker.tsx;packages/lab/src/index.ts.
e851898 to
088eaa8
Compare
a91d4d6 to
2513fb7
Compare
|
Added the first-load size the import-boundaries rule (INV10) asks for. A page that renders CommentComposer without The four blocks that pass EmojiPicker now name it in |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the names and shapes this Comments API pass settles. The review found no defect in the code.
- No current record decides the composer's render-function name
emojiPicker(the alternative isrenderEmojiPicker, which matches the family'srenderComposerand Core'srender…functions), the default with no emoji button, or aloadVersionsthat answers at once or with a Promise, so an engineering owner needs to settle them by commenting/approve-specwith the full head commit SHA, or by naming the record or shape that should govern them; the author can do this only as an engineering owner.
The first-load size the import-boundaries rule asks for is now reported, so that gap is closed. Two non-blocking notes:
- Miss: the composer still gives any picker the fixed width and zero padding tuned for Lab's EmojiPicker (
CommentComposer.tsx:525-529), and neither theemojiPickerdocs nor the comments beside it say so. - Miss: the CommentComposer description and the Comments composer part (
CommentComposer.doc.mjs:13,Comments.doc.mjs:89) still describe an emoji button that a default composer no longer has.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Verified:
emojiPickerreplaceshasEmojiPicker; the composer keeps the button, Popover, open state and focus return, andonSelectinserts the emoji and closes the Popover (CommentComposer.tsx:518-563,CommentComposer.test.tsx:239). - Verified: with no
emojiPickerthere is no emoji button (CommentComposer.tsx:518,CommentComposer.test.tsx:550). - Verified:
CommentEmojiPickerRenderPropsnames what the function receives and is exported (types.ts:247,Comments/index.ts:26). - Verified:
loadVersionsmay answer at once or with a Promise,previousVersionsis gone, and an answer given at once opens with no loading state (CommentsContext.tsx:525-548,Comments.test.tsx:1091). - Verified: with no
loadVersionsthere is no history button (CommentRow.tsx:402,Comments.test.tsx:1117). - Verified: a reaction option is
{key, emoji, label?},isSelectedreplacesreactedByViewer, andDEFAULT_COMMENT_REACTIONSfollows (types.ts:47-67,types.ts:376-384). - Verified:
updatedAtandseenByleaveCommentData, nothing at the base rendered them, and the docs tell products to keep such metadata beside their records (Comments.doc.mjs:111). - Verified: the four blocks pass Lab's EmojiPicker through the slot and list it in
componentsUsed; stories that pass no picker show no emoji button. - Verified: the tests use a stand-in picker and add the at-once history and no-history-button cases; the emoji case checks the insert, the closed Popover and focus on the input (
CommentComposer.test.tsx:239-267). - Verified: the API conventions guide names boolean state
is<Name>and allows a render function when the parent provides data, though the guide itself creates no policy; Core takes an element's human-readable text inlabel(Button, Badge, Token, Tab). - Verified: the person type comes from Core's CommentPin (
types.ts:22), and the fields the description leaves out on purpose are unchanged. - Verified: the branch sits on the
maincommit the description names. - Not reproduced: the first-load figures (−13.2 KB for the composer, −9.6 KB for the panel); the composer no longer imports EmojiPicker, so the change cannot add first-load weight.
- Not checked here: the 103 Vitest tests,
tsc,pnpm review:pre, eslint and prettier. - Files, clear:
apps/storybook/stories/Comments.stories.tsx,internal/eslint-plugin-astryx/no-internal-barrel-import.baseline.json, the fourpackages/lab/blocks/Comment*.tsxblocks and their four.doc.mjsfiles,CommentActions.tsx,CommentComposer.test.tsx,CommentRow.tsx,CommentThread.doc.mjs,CommentThread.test.tsx,CommentThread.tsx,Comments.test.tsx,Comments.tsx,CommentsContext.tsx,i18n.ts,Comments/index.ts,types.ts,EmojiPicker.tsx,packages/lab/src/index.ts. - Files with a non-blocking note:
CommentComposer.tsx(picker panel sizing),CommentComposer.doc.mjsandComments.doc.mjs(an emoji button described as always there).
088eaa8 to
cac80b5
Compare
2513fb7 to
1397124
Compare
|
Both notes are fixed. The |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about three Comments shapes that no current record decides, and two changes are needed whatever that decision is.
- Miss: The picker render prop needs the name
renderEmojiPicker, because DEC-6 of the caller-rendered trigger record (docs/specs/AST-055-caller-rendered-trigger/spec.md) names every function-valued component proprender<X>, so the description's statement that the records are silent on this name does not hold. - Miss: A product picker component that calls a hook, passed as
emojiPicker={ProductPicker}, type-checks but crashes the composer with "Rendered more hooks than during the previous render" on the first press of Add emoji (reproduced locally), becauseCommentComposer.tsx:533calls the function inside the composer's own render while the Popover is open; render it through a small component boundary and add a test with a hook-using picker. - Owner decision: No current record decides the composer showing no emoji button unless a picker is passed,
loadVersionsanswering at once or with a Promise in place ofpreviousVersions, or edit history opening only withloadVersions, so an engineering owner needs to approve these by commenting/approve-specwith the full head commit SHA on this pull request, or name the shape they want; the author can record that approval only as an engineering owner.
The Comments test suite, Lab's typecheck and Prettier pass, reproduced locally, and the first-load size the import-boundaries rule asks for is reported.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
- Title, live: "refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji".
- Verified: the emoji picker is a render function that receives
onSelectand returns the picker (types.ts:246-250,:309;CommentComposer.tsx:531-543). - Verified: the composer keeps the Add emoji button, its Popover, open state and focus handling, and
onSelectinserts the emoji, closes the Popover and focuses the input (CommentComposer.test.tsx"appends a picked emoji to the draft", run here; in the browser, focus lands on the picker's search field on both base and head). - Verified: without a picker there is no emoji button (
CommentComposer.tsx:518; test "leaves the emoji button out without emojiPicker"; the InsideACard and Empty stories show one Add emoji button on the base and none on the head). - Verified: the new render-props type names what the function receives and is exported (
Comments/index.ts:26,packages/lab/src/index.ts:67). - Verified, for the documented element-returning form: a slot lets a product choose any picker; passing a hook-using picker component itself crashes (second finding).
- Verified:
loadVersionsreturns the full history at once or as a Promise,previousVersionsis gone everywhere in the repository, and an answer given at once opens with no loading state (CommentsContext.tsx:525-550; test "opens the edit history at once from versions returned synchronously", run here). - Verified: one history had two inputs at the base (
previousVersionsandloadVersions). - Verified: a reaction option is
{key, emoji, label?},isSelectedreplacesreactedByViewereverywhere in the repository, and the default reactions follow (types.ts:47-67,:376-385). - Verified: Astryx components take a name in
label(Button, Badge, Token, Tab) and the API conventions guide names booleansis<Name>, names slots by their part and allows a render function when the parent provides data. - False: the records are silent on whether a render function takes a
renderprefix; the caller-rendered trigger record's DEC-6 decides it (first finding). - Verified:
updatedAtandseenByleave the comment data, nothing in the family rendered either at the base (searched every reader in packages, apps and internal), and the docs tell products to keep such metadata beside their records (Comments.doc.mjs:111). - Verified: the only new caller decision is which picker to pass; the wider
loadVersionstype needs no caller change. - Verified: the shared person type comes from Core's CommentPin (
types.ts:22), and the fields left out on purpose (logoUrl,isHighlighted,defaultIsSelected, thecan*booleans) are unchanged. - Verified: the four blocks that pass Lab's EmojiPicker are the only ones that do, they list it in
componentsUsed, and the three showcase blocks are among them; stories and examples without a picker show no emoji button. - Verified: the tests use a stand-in picker and import nothing from Lab's EmojiPicker; the new cases cover the at-once history and the missing history button.
- Verified: the docs and JSDoc say the picker fills a fixed-width panel with no padding, the comments beside that panel speak of any picker, and the two composer descriptions no longer promise an emoji button on every composer.
- Verified: the import-boundaries check sizes Core entries only.
- Reported: the first-load figures (13.2 KB less gzip for a composer without a picker, 9.6 KB less for the panel); no Comments source imports EmojiPicker at the head.
- Verified, run here: 103 Comments tests pass; Lab's source and docs typecheck pass after a Lab build; Prettier passes on the changed files.
- Reported: Storybook's typecheck,
pnpm review:preand eslint results; the branch was validated on themaincommit that is its merge base. - Verified: the public text and files carry no internal context.
- Files, first finding (rename):
packages/lab/src/Comments/types.ts,CommentComposer.tsx(also the second finding),CommentRow.tsx,CommentThread.tsx,Comments.tsx,CommentsContext.tsx,CommentComposer.doc.mjs,CommentThread.doc.mjs,Comments.doc.mjs,CommentComposer.test.tsx,CommentThread.test.tsx, the four blocksCommentComposerShowcase.tsx,CommentThreadInPopover.tsx,CommentThreadShowcase.tsx,CommentsShowcase.tsx, andpackages/lab/src/EmojiPicker/EmojiPicker.tsx(header). - Files, clear:
apps/storybook/stories/Comments.stories.tsx,internal/eslint-plugin-astryx/no-internal-barrel-import.baseline.json, the four block.doc.mjsfiles,CommentActions.tsx,Comments.test.tsx,i18n.ts,Comments/index.ts,packages/lab/src/index.ts.
cac80b5 to
013414e
Compare
…omes from loadVersions alone, and reactions name their emoji
The Comments family's API pass before it moves to Core:
- `hasEmojiPicker` becomes `emojiPicker`, a render function that receives
`onSelect` and returns the picker. The composer keeps the Add emoji
button, the Popover, the open state, and focus return; `onSelect` inserts
the emoji and closes the Popover. Without `emojiPicker` there is no emoji
button, so the family no longer imports Lab's EmojiPicker. The new
`CommentEmojiPickerRenderProps` type names what the function receives.
- `loadVersions` returns the full edit history, current version included,
at once or as a Promise, and `previousVersions` goes away. A history
returned at once opens with no loading state.
- A reaction option is `{key, emoji, label?}`: `label` is the reaction's
name, as everywhere else, and the old glyph `label` becomes `emoji`. A
reaction marks the viewer's own with `isSelected` instead of
`reactedByViewer`. `DEFAULT_COMMENT_REACTIONS` follows.
- `updatedAt` and `seenBy`, which nothing rendered, leave CommentData.
Docs, stories, and blocks follow; the blocks pass Lab's EmojiPicker.
1397124 to
af30358
Compare
|
Rebased onto Repeated on this head: |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about three Comments shapes that no current record decides, and two changes are needed whatever that decision is.
- Miss: The picker render prop needs the name
renderEmojiPicker, because DEC-6 of the caller-rendered trigger record (docs/specs/AST-055-caller-rendered-trigger/spec.md) names every function-valued component proprender<X>, so the description's statement that the records are silent on this name does not hold. - Miss: A product picker component that calls a hook, passed as
emojiPicker={ProductPicker}, type-checks but crashes the composer with "Rendered more hooks than during the previous render." on the first press of Add emoji (reproduced locally), becauseCommentComposer.tsx:533calls the function inside the composer's own render while the Popover is open; render it through a small component boundary and add a test with a hook-using picker. - Owner decision: No current record decides the composer showing no emoji button unless a picker is passed,
loadVersionsanswering at once or with a Promise in place ofpreviousVersions, or edit history opening only withloadVersions, so an engineering owner needs to approve these by commenting/approve-specwith the full head commit SHA on this pull request, or name the shape they want; the author can record that approval only as an engineering owner.
The Comments test suite (104 tests), Lab's typecheck and Prettier pass, reproduced locally, and the first-load size the import-boundaries rule asks for is reported.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Title, live: "refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji".
- Verified: the emoji picker is a render function that receives
onSelectand returns the picker (types.ts:246-250,:309;CommentComposer.tsx:532-544). - Verified: the composer keeps the Add emoji button, its Popover, open state and focus handling, and
onSelectinserts the emoji, closes the Popover and focuses the input (CommentComposer.test.tsx"appends a picked emoji to the draft", run here; in the browser, focus lands on the picker's search field on both base and head). - Verified: without a picker there is no emoji button (
CommentComposer.tsx:518; test "leaves the emoji button out without emojiPicker, and adds controls", run here; the InsideACard and Empty stories show one Add emoji button on the base and none on the head). - Verified: the new render-props type names what the function receives and is exported (
Comments/index.ts:26,packages/lab/src/index.ts:67). - Verified, for the documented element-returning form: a slot lets a product choose any picker; passing a hook-using picker component itself crashes (second finding).
- Verified:
loadVersionsreturns the full history at once or as a Promise,previousVersionsis gone everywhere in the repository, and an answer given at once opens with no loading state (CommentsContext.tsx:525-550; test "opens the edit history at once from versions returned synchronously", run here). - Verified: one history had two inputs at the base (
previousVersionsandloadVersions). - Verified: a reaction option is
{key, emoji, label?},isSelectedreplacesreactedByViewereverywhere in the repository, and the default reactions follow (types.ts:47-67,:377-385). - Verified: Astryx components take a name in
label(Button, Badge, Token, Tab) and the API conventions guide names booleansis<Name>, names slots by their part and allows a render function when the parent provides data. - False: the records are silent on whether a render function takes a
renderprefix; the caller-rendered trigger record's DEC-6 decides it (first finding). - Verified:
updatedAtandseenByleave the comment data, nothing in the family rendered either at the base (searched every reader in packages, apps and internal), and the docs tell products to keep such metadata beside their records (Comments.doc.mjs:111). - Verified: the only new caller decision is which picker to pass; the wider
loadVersionstype needs no caller change. - Verified: the shared person type comes from Core's CommentPin (
types.ts:22), and the fields left out on purpose (logoUrl,isHighlighted,defaultIsSelected, thecan*booleans) are unchanged. - Verified: the four blocks that pass Lab's EmojiPicker are the only ones that do, they list it in
componentsUsed, and the three showcase blocks are among them; stories and examples without a picker show no emoji button. - Verified: the tests use a stand-in picker and import nothing from Lab's EmojiPicker; the new cases cover the at-once history, the missing history button, and the insert, closed Popover and returned focus after a pick.
- Verified: the docs and JSDoc say the picker fills a fixed-width panel with no padding, the comments beside that panel speak of any picker, and the two composer descriptions no longer promise an emoji button on every composer.
- Verified: the import-boundaries check sizes Core entries only.
- Reported: the first-load figures (13.2 KB less gzip for a composer without a picker, 9.6 KB less for the panel); no Comments source imports EmojiPicker at the head.
- Verified, run here: 104 Comments tests pass; Lab's source and docs typecheck pass after a Lab build; Prettier passes on the changed files.
- Reported: Storybook's typecheck,
pnpm review:preand eslint results. - Verified: the branch was rebased onto
mainwith the rest of the stack and its own patch is unchanged (the same patch ID before and after). - Verified: the public text and files carry no internal context.
- Files, first finding (rename):
packages/lab/src/Comments/types.ts,CommentComposer.tsx(also the second finding),CommentRow.tsx,CommentThread.tsx,Comments.tsx,CommentsContext.tsx,CommentComposer.doc.mjs,CommentThread.doc.mjs,Comments.doc.mjs,CommentComposer.test.tsx,CommentThread.test.tsx, the four blocksCommentComposerShowcase.tsx,CommentThreadInPopover.tsx,CommentThreadShowcase.tsx,CommentsShowcase.tsx, andpackages/lab/src/EmojiPicker/EmojiPicker.tsx(header). - Files, clear:
apps/storybook/stories/Comments.stories.tsx,internal/eslint-plugin-astryx/no-internal-barrel-import.baseline.json, the four block.doc.mjsfiles,CommentActions.tsx,Comments.test.tsx,i18n.ts,Comments/index.ts,packages/lab/src/index.ts.
…t 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 `emojiPicker` becomes
`renderEmojiPicker` on Comments, CommentThread, and CommentComposer, with
their docs, blocks, and tests.
The composer called the picker function inside its own render, and only
while the Popover was open. A picker component that calls hooks then added
hooks to that render and crashed the composer ("Rendered more hooks than
during the previous render"). The picker now renders through a small
component, so its hooks run in their own fiber.
|
Both required changes are in one new commit on this branch:
On this head: 105 Comments tests pass. The Core build, the Lab build and The description now cites DEC-6 for the name. It lists the three shapes still waiting on the spec owner's The commit sits on top of the old head, so #13736–#13739 keep their heads and approvals. #13741 picks this commit up through a merge. |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about three Comments shapes that no current record decides; both changes the last review asked for are in, and nothing else needs to change.
- Owner decision: No current record decides that a composer shows no emoji button unless a picker is passed, that
loadVersionsmay answer at once or with a Promise in place ofpreviousVersions, or that an edited comment opens its history only whenloadVersionsis set, so an engineering owner records approval by commenting/approve-specwith the full head commit SHA on this pull request, or names the shape they want; the author may record it if they are an engineering owner.
The renderEmojiPicker name now follows the render<X> rule, and a picker component that calls hooks renders in its own component: the new test passes, and fails without the slot when reproduced locally. The Comments suite (105 tests), the builds, Lab's typecheck, Prettier and ESLint pass locally; CI has not run on this head yet.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Title, live: "refactor(Comments): the emoji picker is a render prop, edit history comes from loadVersions alone, and reactions name their emoji".
- Verified: the emoji picker is a render function,
renderEmojiPicker, that receivesonSelectand returns the picker (types.ts:246-250,:309;CommentComposer.tsx:543-555). - Verified: the composer keeps the Add emoji button, its Popover, open state and focus handling;
onSelectinserts the emoji, closes the Popover and focuses the input (test "appends a picked emoji to the draft", run locally; in the browser focus lands on the picker's search field on both base and head). The focus code is unchanged apart from the slot, so none of the usual focus edge cases (an unfocused or disabled opener, a stacked popover, a frame or shadow root) changes it. - Verified: without a picker there is no emoji button (
CommentComposer.tsx:529; test "leaves the emoji button out without renderEmojiPicker, and adds controls", run locally; the InsideACard and Empty stories show one Add emoji button on the base and none on the head). - Verified: the new render-props type names what the function receives and is exported (
Comments/index.ts:26,packages/lab/src/index.ts:67). - Verified: a slot lets a product choose any picker, including a picker component that calls hooks (test "renders a picker component that calls hooks", run locally; it fails with "Rendered more hooks than during the previous render." when the slot is replaced by a direct call).
- Verified:
loadVersionsreturns the full history at once or as a Promise,previousVersionsis gone everywhere in the repository, and an answer given at once opens with no loading state (CommentsContext.tsx:511-550; test "opens the edit history at once from versions returned synchronously", run locally). - Verified: one history had two inputs at the base (
previousVersionsandloadVersions). - Verified: a reaction option is
{key, emoji, label?},isSelectedreplacesreactedByViewereverywhere in the repository, and the default reactions follow (types.ts:47-67,:377-385). - Verified: Astryx components take a name in
label(Button, Badge, Token, Tab) and the API conventions guide names booleansis<Name>, names slots by their part and allows a render function when the parent provides data. - Verified: the render prop's name follows the caller-rendered trigger record's
render<X>decision, like the family'srenderBodyandrenderComposer. - Verified:
updatedAtandseenByleave the comment data, nothing in the family rendered either at the base (searched every reader in packages, apps and internal), and the docs tell products to keep such metadata beside their records (Comments.doc.mjs:111). - Verified: the only new caller decision is which picker to pass; the wider
loadVersionstype needs no caller change. - Verified: the shared person type comes from Core's CommentPin (
types.ts:22), and the fields left out on purpose (logoUrl,isHighlighted,defaultIsSelected, thecan*booleans) are unchanged. - Verified: the four blocks that pass Lab's EmojiPicker are the only ones that do, they list it in
componentsUsed, and stories and examples without a picker show no emoji button. - Verified: the tests use a stand-in picker and import nothing from Lab's EmojiPicker; the new cases cover the at-once history, the missing history button, the hook-using picker, and the insert, closed Popover and returned focus after a pick.
- Verified: the docs and JSDoc say the picker fills a fixed-width panel with no padding, the comments beside that panel speak of any picker, and the composer descriptions no longer promise an emoji button on every composer.
- Verified: the import-boundaries check sizes Core entries only.
- Reported: the first-load figures (13.2 KB less gzip for a composer without a picker, 9.6 KB less for the panel); no Comments source imports EmojiPicker at the head.
- Verified, run locally: 105 Comments tests pass; the Core and Lab builds and Lab's source and docs typecheck pass; Prettier passes on the changed files; strict ESLint reports no errors (two warnings sit on unchanged lines).
- Reported: Storybook's typecheck, the pre-review checklist and the knowledge check.
- Verified: the branch sits on
mainwith the stack below it, and the rename and the slot fix are one commit on top of the previous head. - Verified: the public text and files carry no internal context.
- Files, clear:
apps/storybook/stories/Comments.stories.tsx,internal/eslint-plugin-astryx/no-internal-barrel-import.baseline.json,packages/lab/blocks/CommentComposerShowcase.doc.mjs,CommentComposerShowcase.tsx,CommentThreadInPopover.doc.mjs,CommentThreadInPopover.tsx,CommentThreadShowcase.doc.mjs,CommentThreadShowcase.tsx,CommentsShowcase.doc.mjs,CommentsShowcase.tsx,packages/lab/src/Comments/CommentActions.tsx,CommentComposer.doc.mjs,CommentComposer.test.tsx,CommentComposer.tsx,CommentRow.tsx,CommentThread.doc.mjs,CommentThread.test.tsx,CommentThread.tsx,Comments.doc.mjs,Comments.test.tsx,Comments.tsx,CommentsContext.tsx,i18n.ts,index.ts,types.ts,packages/lab/src/EmojiPicker/EmojiPicker.tsx,packages/lab/src/index.ts.
Stacked on the four Comments fixes (#13736, #13737, #13738, #13739), which are stacked on the CommentPin PRs (#13702, #13735). Review those first; this PR's base is #13739's branch.
Primary intent
The Comments family's API pass before it moves to Core. Its API review raised these changes; this PR makes the ones the records decide or the spec owner suggested. It is a reshaping of an existing Lab API, not a bug fix or a new capability, so no more specific template fits.
User or maintainer impact
Builders who use Lab's Comments get the names Core uses everywhere else and lose three fields that did nothing or duplicated another path. Once the family is in Core, these names are hard to change, so they settle here, while the family is still in Lab.
Problem and solution fit
hasEmojiPickerbecomesrenderEmojiPicker, a render function that receivesonSelectand returns the picker. The composer keeps the Add emoji button, the Popover, its open state, and focus return.onSelectinserts the emoji and closes the Popover. WithoutrenderEmojiPickerthere is no emoji button. The newCommentEmojiPickerRenderPropstype names what the function receives.loadVersionsreturns the full history, current version included, at once or as a Promise.previousVersionsgoes away. A history returned at once opens with no loading state.{key, emoji, label?}. The old glyphlabelbecomesemoji, andlabelis the reaction's name, as everywhere else.isSelectedreplacesreactedByViewer.DEFAULT_COMMENT_REACTIONSfollows.labelfor an element's human-readable name andis*for booleans.updatedAtandseenByleaveCommentData.Before and after:
New caller decisions: which picker to pass, if any. Everything else is a rename or a removal.
Authority
docs/contributing/api-conventions.mdnames boolean stateis<Name>(soisSelected), names a slot by its part (topNav,sideNav), and allows a render function when the parent must provide data, as the composer providesonSelecthere. Astryx components take an element's human-readable text inlabel(Button, Badge, Token, Tab), so a reaction's name is itslabel.spec:AST-055(caller-rendered triggers) DEC-6, a current record: a public component prop whose value is a function that returns rendered output is namedrender<X>. So the slot isrenderEmojiPicker, like the family'srenderBodyandrenderComposer, and its name is not an open question./approve-spec), since no current record decides them: a composer shows no emoji button unless a picker is passed;loadVersionsanswers at once or with a Promise, in place ofpreviousVersions; and edit history opens only withloadVersions.{id, name, src}is already in refactor(CommentPin): uncontrolled selection, Comments' person type, and ElementSize; the host hides resolved pins, and isDimmed is removed #13702 and its Core move, feat(core): CommentPin moves to Core #13735.Left out on purpose:
logoUrltosrc, and movingisHighlightedout of the thread data. The review itself flagged both as needing an owner decision.defaultIsSelectedon CommentThread, and renaming thecan*booleans. No record decides them and the review made no suggestion, so they stay as they are and go to the owner.Change and evidence
loadVersionsmeans no history button. The emoji cases check the insert, the closed Popover, and focus back on the input.componentsUsed.renderEmojiPickerdocs and JSDoc say that the picker fills a fixed-width panel with no padding, so it brings its own, and the comments beside that panel speak of any picker. The CommentComposer description and the Comments composer part no longer promise an emoji button on every composer.useState; it fails without the fix.architecture:component-import-boundariesINV10: an optional feature costs nothing where it is unused). A page that renders CommentComposer withoutrenderEmojiPicker: 185.4 KB → 172.2 KB gzip (−13.2 KB), since EmojiPicker leaves the eager graph. A page that renders the Comments panel withoutrenderEmojiPicker: 390.5 KB → 380.9 KB gzip (−9.6 KB). 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.Scope
Components: Comments, CommentThread, CommentComposer
Testing
Repeated on this head:
vitest run packages/lab/src/Comments: 105 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:pre: 0 findings.pnpm check:knowledge: clean.tscfor Lab and Lab docs, after a Lab build: pass. Storybooktsc: no errors in the Comments stories.pnpm review:pre: 0 findings.eslintandprettieron the changed files: clean.Sits on
mainat 2608fe4, with the pull requests below this one. The rename and the slot fix are one commit added on top, so the pull requests below keep their heads.