Skip to content

[docs-infra] Migrate demos to docs-infra - #23851

Open
brijeshb42 wants to merge 47 commits into
mui:masterfrom
brijeshb42:docs-infra/migrate-demos
Open

brijeshb42 wants to merge 47 commits into
mui:masterfrom
brijeshb42:docs-infra/migrate-demos

Conversation

@brijeshb42

@brijeshb42 brijeshb42 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Migrate all MUI X docs demos to @mui/internal-docs-infra: Data Grid, Charts, Date Pickers, Tree View, Scheduler and Chat. Keep previews, live editing, source controls and sandbox exports while generating JavaScript and highlighting from TypeScript.

  • Demos have one authored source. Replace generated JavaScript and preview files with a demo directory. The audit finds 1,522 entries, 1,547 Markdown references, no legacy demo directives and no missing targets. Helper JavaScript, datasets and workers remain. CONTRIBUTING.md documents demo creation.

    Before: date-picker/{DatePickerValue.tsx,DatePickerValue.js,DatePickerValue.tsx.preview}
    After:  date-picker/demos/date-picker-value/{DatePickerValue.tsx,index.ts,client.ts}
    
  • Markdown loads the new entry. Update imports, regression routes and LLM docs generation alongside the move.

    -{{"demo": "DatePickerValue.js"}}
    +{{"component": "file://./demos/date-picker-value/index.ts"}}
  • Source controls preserve the running demo. Changing chart type, showing/hiding code and activating the editor keeps the same preview DOM and state. Edits survive collapse/reopen; Reset restores the bundled demo. Pristine focus snippets remain visible; edited full files and selected helpers hide on collapse.

  • First clicks keep the caret. Full source and contiguous focus snippets use the server-rendered input from mui-public#2125 and material-ui#49910. Hydration binds editing to that input. No idle editor/runner initialization runs. Parser readiness preserves selection and undo; changing source scope or language starts a new history so undo cannot replace a full file with a snippet or JS with TS.

  • Cold edits retain every file. Root, helper and CSS edits made while the source module loads apply in order. Reset cancels earlier pending edits; focus metadata survives sequential line edits.

  • Source styles load lazily. The app imports the public syntax stylesheet after mount. Turbopack and Webpack retain colored tokens before editor activation. Long lines scroll; short snippets have no forced scrollbar. material-ui#49874 keeps scrollbar space stable.

  • Keyboard chart tooltips stay anchored. Removing the frame's layout containment in material-ui#49891 corrects the reported 360px offset. The browser test checks alignment with the focused chart item.

  • Deferred source avoids the startup chunk map. Content-hashed JSON assets from mui-public#2105 load source metadata when needed. Server rendering and Turbopack retain their existing transport.

Review:

Charts review example: KeyboardNavigation. demos/<slug> is a source directory, not a published docs page.

Packages:

The override keeps one SDK runtime across X and core-docs. Scoped overrides retain npm extractor 0.1.1-canary.3, Material UI 9.6.0 and the existing markdown release. Replace previews and remove their temporary overrides after release. blockExoticSubdeps is temporarily disabled for nested preview URLs; restore it with npm packages. No preview patches, core-docs source aliases or local archives remain.

Performance at dffa8c8dbf against master (build EajnNa0G5hdhbm9DZdK11). Lighthouse 13.4.1 with the default simulated throttling, performance category only, headless Chromium, a fresh browser per run, and alternating order within each pair. The PR side used its pinned deploy URL; build IDs stayed the same for every run, and no run failed.

Page Device Pairs Score TBT, ms LCP, ms JS, KB Scripts
Data Grid editing Desktop 7 94 → 95 66 → 66 1,024 → 1,057 1,030 → 974 39 → 38
Charts accessibility Mobile 15 84 → 88 417 → 366 2,554 → 2,379 853 → 842 35 → 39

Values are medians, master → PR.

Verdict: no regression. The pass bar was a median score no more than 3 points lower and median TBT no more than 50 ms higher; both pages pass. Paired sign tests find no metric that is significantly worse. Mobile TBT is lower (worse in 3 of 15 pairs, p=0.035), and desktop main-thread work is lower (worse in 0 of 7 pairs, p=0.016). On mobile, the score ranges from 64 to 89 on master and from 68 to 90 on the PR across runs of the same build, so a single DevTools run cannot tell the two apart. The PR loads four more scripts on the mobile page while sending less JavaScript.

Tests:

  • demo-docs.spec.ts: Data Grid editing/reset, errors, languages, keyboard controls, source links and sandbox submissions.
  • tree-view-docs.spec.ts: JavaScript-disabled preview/toolbar/source, accessible readonly input, hydration input identity, hidden focus markers, deep links and shared-module editing/export.
  • demo-variants.spec.ts: source visibility, language/helper switches, computed syntax colors, iframe demos, responsive controls, chart/grid state and keyboard-tooltip coordinates.
  • docs-demo-exports.spec.ts: sandbox peer dependencies and shared helpers.
  • docs-fonts.spec.ts: branded typography across hydration.

Validation: native TypeScript, lint, dedupe and frozen install pass with both published preview packages. The SDK passes 6,503 unit/106 browser tests; core-docs passes 348 browser checks across Chromium, Firefox and WebKit. Local production exports cover 734 pages and 112,689 links with zero broken links. Source-variant checks pass 65/65 over five repetitions; fresh-server SSR/hydration, first-click caret, chart DOM/state and scroll checks pass with the final SDK. All 41 final deployed demo website tests pass. The deployed SDK fingerprint matches the published package; first-click caret, chart DOM/state and source/page scroll remain intact. CI is green. The final Material comparison is recorded in material-ui#49910.

Known gaps:

  • Generated bot preview links can retain demos/<slug> and return 404; the dashboard fix remains separate. See the review.
  • Collapsed disjoint focus ranges retain the existing static renderer; expanded source uses the input. See mui-public#2125.

@code-infra-dashboard

code-infra-dashboard Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler ▼-185B(-0.05%) ▼-43B(-0.04%)
@mui/x-scheduler-premium ▼-185B(-0.04%) ▼-33B(-0.02%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

No regressions in 38 benchmarks · precise to ±9.9% (±68.7% at worst) · ran 7m 08s · details


Check out the code infra dashboard for more information about this PR.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@brijeshb42
brijeshb42 marked this pull request as ready for review October 13, 2026 14:36
@brijeshb42 brijeshb42 changed the title [docs] Migrate Tree View demos to docs-infra [docs] Migrate demos to docs-infra Oct 13, 2026
@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from a6a72a0 to 89ab5cd Compare October 13, 2026 15:56
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 13, 2026
@brijeshb42 brijeshb42 added docs Improvements or additions to the documentation. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Oct 13, 2026
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from 3c0186d to 4e6d7d2 Compare October 14, 2026 11:57
@github-actions github-actions Bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from 4e6d7d2 to 8c1a33c Compare October 15, 2026 08:42
@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from 8c1a33c to 2b2947d Compare October 15, 2026 09:02
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 15, 2026
@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from 59ca5c4 to 2476ac6 Compare October 16, 2026 07:49
@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from 2476ac6 to d0d9cd7 Compare October 16, 2026 13:21
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@JCQuintas

Copy link
Copy Markdown
Member

Why is this even more files to review? Wouldn't it make sense for most of these to come from build time instead? 🤔

@brijeshb42
brijeshb42 force-pushed the docs-infra/migrate-demos branch from d0d9cd7 to 7ae34b7 Compare October 29, 2026 10:17
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 29, 2026
Use stable Material 9.5 and the tested core-docs preview. Keep Picker
focus behavior while avoiding unused menu and snackbar initialization.
Replace the five internal package previews with published canaries.
Remove preview peer overrides and restore the exotic dependency policy.

Align CI and Netlify with the packages' Node requirement. Declare the
sandbox decoder dependency used by the docs tests.
Pick up mui/mui-public#2125 after its rebase and
mui/material-ui#49910, which mounts the live source editor on
interaction instead of after load.
Pick up mui/mui-public#2125 and mui/material-ui#49910: the editor
now mounts on the first interaction, with the caret at the clicked
point, instead of replacing the static source after load. Update the
website specs to that contract.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants