Skip to content

fix(docsite): seed Grid/Stack family Properties previews with playground defaults - #5912

Merged
cixzhang merged 3 commits into
facebook:mainfrom
HelloOjasMutreja:docs/grid-stack-family-playground-defaults
Sep 3, 2026
Merged

fix(docsite): seed Grid/Stack family Properties previews with playground defaults#5912
cixzhang merged 3 commits into
facebook:mainfrom
HelloOjasMutreja:docs/grid-stack-family-playground-defaults

Conversation

@HelloOjasMutreja

@HelloOjasMutreja HelloOjasMutreja commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Six components in the Grid/Stack layout family rendered an empty Properties-tab preview:

  • Grid, Stack, HStack, VStack: no playground.defaults, so the preview had no children.
  • GridSpan, StackItem: no child content, and no parent context (Grid / HStack) to participate in.

Each is an atomic, independently closable slice of #2008, filed by the nightly vibe-test bot as #5892, #5893, #5894, #5898, #5899, #5900.

Fix

Followed the established pattern from prior merged fixes of this exact class (#4138, #2815, #3183, #3175):

  • Grid, Stack, HStack, VStack: added playground.defaults.children, a few Card elements, matching the convention in Card.doc.mjs/OverflowList.doc.mjs.
  • GridSpan, StackItem: these are sub-components that render nothing meaningful in isolation (a grid item with no grid, a flex item with no flex row). Gave each its own playground (overriding the one it would otherwise inherit from its parent doc) using playground.wrapper to render it inside a real Grid/HStack, so the span/fill behavior is actually visible.

Testing

  • Added regression tests to component-preview-state.test.ts (Grid, Stack, HStack, VStack, matching the exact style of the existing OverflowList/DropdownMenu tests) and component-detail-resolve-elements.test.ts (GridSpan, StackItem, verifying their playground.wrapper config resolves to a real component).
  • Full apps/docsite test suite: 443 passing (17 pre-existing failures unrelated to this change, confirmed identical on a clean baseline).
  • tsc --noEmit: 27 pre-existing errors, identical count with and without this diff.
  • Verified against the real docsite dev server (pnpm generate && next dev), not just the source or unit tests: navigated to all six Properties-tab pages and visually confirmed each renders a real, non-empty preview (Grid shows three cards in a 3-column layout, Stack/HStack/VStack each show three cards in their respective direction, GridSpan shows "Spans 2 columns" inside a real Grid, StackItem shows a full-width "Fills the row" card inside a real HStack). No screenshots attached; my environment for this session doesn't have a straightforward way to export the browser tool's captures as attachable image files, so this is a direct description of what was checked rather than a substitute for it.

Fixes #5892, #5893, #5894, #5898, #5899, #5900

@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 3, 2026 4:35pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 2, 2026
@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
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

Grid (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 347 -
Complexity N/A Very High (35) -
Stack (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 388 -
Complexity N/A High (29) -

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

@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, the six previews now render correctly. One thing before merge: the tests duplicate the new fixture values instead of reading the docs. I reverted all six playground configs and every changed test still passed (36/36), so the empty-preview bug can return undetected. Could you assert the extracted playground configs, especially both wrappers, in data-extraction.test.ts?

[Reviewed by Robohands]

…und defaults

Grid, Stack, HStack, VStack, GridSpan, and StackItem all rendered an
empty Properties-tab preview: the parent components had no playground
children, and the two sub-components (GridSpan, StackItem) render
nothing meaningful without the parent context they participate in.

Grid/Stack/HStack/VStack get playground.defaults.children (a few Card
elements). GridSpan and StackItem get their own playground overriding
the inherited one, using playground.wrapper to render them inside a
real Grid/HStack so the span/fill behavior is actually visible instead
of an isolated, context-less box.

Verified against the real docsite dev server (pnpm generate && next
dev), not just the source: all six Properties-tab pages now render
real, non-empty previews.

Fixes facebook#5892, facebook#5893, facebook#5894, facebook#5898, facebook#5899, facebook#5900
…istry

The existing tests exercised the playground mechanism (buildInitialState,
resolveValue) with hand-typed fixture values matching the new configs,
not the actual persisted .doc.mjs playground fields. Reverting the six
playground configs left every changed test passing, so the empty-preview
bug could return undetected.

Adds assertions against componentRegistry (built fresh from the actual
.doc.mjs source via `pnpm generate`) for all six components, covering
both wrappers (GridSpan into Grid, StackItem into HStack). Verified
these catch a revert: reverted the three doc.mjs files, regenerated,
confirmed all six new tests fail, then restored the real changes and
confirmed they pass again.
@HelloOjasMutreja
HelloOjasMutreja force-pushed the docs/grid-stack-family-playground-defaults branch from 71f63af to 4972ccd Compare September 3, 2026 16:31
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Good catch, confirmed the exact gap: my tests exercised the playground mechanism with hand-typed fixture values, not the actual persisted .doc.mjs config. Added assertions against componentRegistry (built from the real doc source via pnpm generate) for all six components, including both wrappers (GridSpan into Grid, StackItem into HStack).

Verified these actually catch a revert before pushing: reverted the three .doc.mjs files, regenerated, confirmed all six new tests fail with the expected "received undefined" errors, then restored the real changes and confirmed they pass again.

@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, this now protects the real generated registry: removing any of the six preview configs fails the new tests, and all six Properties previews render correctly.

[Reviewed by Robohands]

@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 enabled auto-merge (squash) September 3, 2026 21:20
@cixzhang
cixzhang merged commit a13883d into facebook:main Sep 3, 2026
28 of 29 checks passed
josephfarina pushed a commit that referenced this pull request Sep 4, 2026
…und defaults (#5912)

* fix(docsite): seed Grid/Stack family Properties previews with playground defaults

Grid, Stack, HStack, VStack, GridSpan, and StackItem all rendered an
empty Properties-tab preview: the parent components had no playground
children, and the two sub-components (GridSpan, StackItem) render
nothing meaningful without the parent context they participate in.

Grid/Stack/HStack/VStack get playground.defaults.children (a few Card
elements). GridSpan and StackItem get their own playground overriding
the inherited one, using playground.wrapper to render them inside a
real Grid/HStack so the span/fill behavior is actually visible instead
of an isolated, context-less box.

Verified against the real docsite dev server (pnpm generate && next
dev), not just the source: all six Properties-tab pages now render
real, non-empty previews.

Fixes #5892, #5893, #5894, #5898, #5899, #5900

* chore(changeset): add patch changeset for Grid/Stack Properties preview fix

* test(docsite): assert Grid/Stack playground configs from the real registry

The existing tests exercised the playground mechanism (buildInitialState,
resolveValue) with hand-typed fixture values matching the new configs,
not the actual persisted .doc.mjs playground fields. Reverting the six
playground configs left every changed test passing, so the empty-preview
bug could return undetected.

Adds assertions against componentRegistry (built fresh from the actual
.doc.mjs source via `pnpm generate`) for all six components, covering
both wrappers (GridSpan into Grid, StackItem into HStack). Verified
these catch a revert: reverted the three doc.mjs files, regenerated,
confirmed all six new tests fail, then restored the real changes and
confirmed they pass again.
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] Grid Properties preview renders no working component

2 participants