Skip to content

docs(ChatComposerTokenElement): add playground token fixture (#5886) - #5906

Merged
cixzhang merged 1 commit into
facebook:mainfrom
Rijul202:fix/chatcomposertokenelement-preview-5886
Sep 3, 2026
Merged

docs(ChatComposerTokenElement): add playground token fixture (#5886)#5906
cixzhang merged 1 commit into
facebook:mainfrom
Rijul202:fix/chatcomposertokenelement-preview-5886

Conversation

@Rijul202

@Rijul202 Rijul202 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #5886.

Problem

On the ChatComposerTokenElement Properties tab, the preview renders:

Interactive preview needs required props that cannot be generated automatically. Missing: token.

The doc has a required token prop of type ChatComposerToken but no playground.defaults entry for it, and the generic preview cannot synthesize that object automatically.

Fix

Add a minimal badge-style token fixture to playground.defaults:

playground: {
  defaults: {
    token: {value: '@astryx', label: '@astryx', variant: 'blue'},
  },
},

This follows the same pattern as other docs whose required props are objects — e.g. Citation (source), NavMenu (children), Dialog (children). The badge shape ({value, label, variant?}) matches ChatComposerToken as used elsewhere in the package (e.g. ChatComposerInput.test.tsx, which uses variant: 'blue').

Why it works

In apps/docsite/src/components/component-detail/interactiveState.ts, buildInitialState() seeds state from playground.defaults before computing missing props, and getMissingRequiredProps() only reports required props where state[name] === undefined. With the default present, state.token is defined, so token is no longer reported missing and the token chip renders.

Docs-only change (single .doc.mjs), no public API or runtime change.

…k#5886)

The Properties tab preview showed "Interactive preview needs required props
that cannot be generated automatically. Missing: token." because the doc had
no playground.defaults entry for the required `token` prop, and the generic
preview cannot synthesize a ChatComposerToken.

Add a minimal badge-style token fixture to playground.defaults, matching the
pattern used by other docs with required object props (e.g. Citation, NavMenu,
Dialog). buildInitialState() seeds state.token from this default, so
getMissingRequiredProps() no longer reports it and the token chip renders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Rijul202
Rijul202 requested a review from cixzhang as a code owner September 2, 2026 07:07
Copilot AI lite review requested due to automatic review settings September 2, 2026 07:07
@meta-cla

meta-cla Bot commented Sep 2, 2026

Copy link
Copy Markdown

Hi @Rijul202!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 2, 2026 7:11am UTC

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It adds a new docsite-facing default for a previously broken preview path but does not include the focused docsite test coverage called for in the linked issue’s acceptance criteria.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes the docsite “missing required props” placeholder for ChatComposerTokenElement by providing a concrete playground.defaults.token fixture, enabling the Properties tab interactive preview to render a token chip immediately.

Changes:

  • Add playground.defaults.token to ChatComposerTokenElement component docs to satisfy the required token: ChatComposerToken prop.
File summaries
File Description
packages/core/src/Chat/ChatComposerTokenElement.doc.mjs Seeds a minimal badge-style token in playground.defaults so the docsite interactive preview can render without missing-props errors.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +11 to +15
playground: {
defaults: {
token: {value: '@astryx', label: '@astryx', variant: 'blue'},
},
},
@meta-cla

meta-cla Bot commented Sep 2, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 2, 2026
@meta-cla

meta-cla Bot commented Sep 2, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I checked the docsite and looks good!

@cixzhang
cixzhang enabled auto-merge (squash) September 2, 2026 22:22
github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Chat (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 5424 -
Complexity N/A Very High (443) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 3, 2026
@cixzhang
cixzhang merged commit 49625f5 into facebook:main Sep 3, 2026
27 of 28 checks passed
josephfarina pushed a commit that referenced this pull request Sep 4, 2026
…5906)

The Properties tab preview showed "Interactive preview needs required props
that cannot be generated automatically. Missing: token." because the doc had
no playground.defaults entry for the required `token` prop, and the generic
preview cannot synthesize a ChatComposerToken.

Add a minimal badge-style token fixture to playground.defaults, matching the
pattern used by other docs with required object props (e.g. Citation, NavMenu,
Dialog). buildInitialState() seeds state.token from this default, so
getMissingRequiredProps() no longer reports it and the token chip renders.

Co-authored-by: Rijul202 <rijulyadav208@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ChatComposerTokenElement Properties preview renders no working component

3 participants