Skip to content

[docs-infra] StackBlitz WebContainer demos #45924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Apr 15, 2025

Introduce demo/template sandboxes based on StackBlitz WebContainers so that they run real vite applications. I'm removing the old stackblitz links and codesandbox links as they are obsolete now and too unstable.

Advantages:

  • closer to end user setup
  • can use codesandboxci/pkg.pr.new dependencies
  • more stable than current stackblitz and codesandbox demos
  • can fork and then immediately open in bolt.new
  • download button on sandbox now produces correct folder

Disadvatages:

  • slower to start up
  • more files in the demo project

Try it out on https://deploy-preview-45924--material-ui.netlify.app/material-ui/react-button/

verified:

  • some button demos
  • some autocomplete demos
  • system demos
  • theme switcher demo
  • templates
  • joy templates
  • some joy demos
  • datagrid demo
  • datagrid pro/premium demos
  • date pickers
  • charts
  • treeview

@Janpot Janpot added docs Improvements or additions to the documentation scope: docs-infra Specific to the docs-infra product labels Apr 15, 2025
@mui-bot
Copy link

mui-bot commented Apr 15, 2025

Netlify deploy preview

https://deploy-preview-45924--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against ed758b3

@Janpot Janpot marked this pull request as ready for review April 16, 2025 10:02
@Janpot Janpot requested a review from a team April 16, 2025 14:23
@@ -1,99 +1,202 @@
import addHiddenInput from 'docs/src/modules/utils/addHiddenInput';
import { CODE_VARIANTS } from 'docs/src/modules/constants';
import sdk from '@stackblitz/sdk';
Copy link
Member

Choose a reason for hiding this comment

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

Is this worth 3KB gzipped? https://bundlephobia.com/package/@stackblitz/sdk@1.11.0 What complexity does it solve that we really need this for? I mean what's wrong with making a call to the HTTP API ourselves directly?

Copy link
Member

@oliviertassinari oliviertassinari Apr 16, 2025

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the sdk again. We're downloading 3MB of resources on initial load so optimizing for 2.5kB is not really going to be noticable 😬 but it's the principle.

Copy link
Member

@oliviertassinari oliviertassinari Apr 17, 2025

Choose a reason for hiding this comment

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

We're downloading 3MB of resources on initial load

Gzipped? Oh wow, probably part of why the docs is so slow now 🙃. I recall a time where every byte had to fight for its place on the bundle 😁. I will look a bit closer at this.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, it's on my radar as well now. hopefully something the new code infra role can look into as well.

</IconButton>
</DemoTooltip>
<DemoTooltip title={t('codesandbox')} placement="bottom">
<IconButton
Copy link
Member

@oliviertassinari oliviertassinari Apr 16, 2025

Choose a reason for hiding this comment

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

Copy link
Member Author

@Janpot Janpot Apr 17, 2025

Choose a reason for hiding this comment

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

Why remove codesandbox?

It's broken. And it doesn't look like they prioritize at all. I'm bringing back the codesandboxes, we can discuss removing it separately.

It looks like the majority of our users go with codesandbox.

The numbers may also be a bit skewed as in some places in the docs there is only codesandbox available (e.g. joy templates)

Copy link
Member Author

Choose a reason for hiding this comment

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

I brought back codesandbox, we can discuss removing it separately

Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

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

LGTM!

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 scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants