-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[docs-infra] Improve StackBlitz support #40832
Conversation
Netlify deploy previewhttps://deploy-preview-40832--material-ui.netlify.app/ Bundle size report |
const muiCommitRef = process.env.PULL_REQUEST_ID ? process.env.COMMIT_REF : undefined; | ||
versions = muiDocConfig.csbGetVersions(versions, { muiCommitRef }); | ||
versions = muiDocConfig.csbGetVersions(versions, { muiCommitRef: commitRef }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solves a bug on other repositories using docs-infra, e.g. https://deploy-preview-11848--material-ui-x.netlify.app/x/react-data-grid/editing/#full-featured-crud StackBlitz is broken, CodeSandbox works, this is because of stackblitz/core#437
One thing I do want to note on this:
We won't deprecate our sandboxes experience, we'll improve it in the future as well (VSCode extension marketplace support being the next feature we'll release). Ultimately, we want to use the best tool for the job and for examples it's best to run in the browser when that's smoothly possible. That said, our time is spent mostly on making CodeSandbox a great place to do development. In our sandbox solution, we also load NPM dependencies directly from the registry. The majority of our bandwidth comes from serving the web app and the preview resources (xxx.csb.app). |
@CompuIves Thanks for the context! I have updated the reasoning to be more accurate, this feel balanced ⚖️ |
Problem
CodeSandbox is changing its pricing, see https://www.codesandbox.community/c/api-billing-updates/upcoming-pricing-billing-changes. Developers who want to report a bug or edit demos might hit a paywall. Sandboxes are paid after 20. This limit at 20 could be annoying for some of the developers browsing the docs. This can also be a problem for bug reproduction on GitHub. Community members might not be able to easily them if its on CodeSandbox, so increasing the odd for reproduction to be on StackBlitz is likely a win.
Context
Today, CodeSandbox is 70% of the use while StackBlitz is 30%:
https://analytics.google.com/analytics/web/#/analysis/p353089763/edit/KctZ977QSou7VoMyBQMaqw
StackBlitz is up 76% from 6 months ago 83% / 17%. It's not StackBlitz that is used more but rather it seems to be that CodeSandbox is used less frequently as developers learn they can use the live edit feature of our demos in the docs. My assumption is that developers were defaulting to the easier-to-reach icon.
Solution
This PR makes using StackBlitz less friction for users to adopt:
Before:
After:
I think we need to point the community to the least friction code edition experience. It seems that StackBlitz % of use should be higher than 30%:
Fetching packages directly from the npm registry means a massive cost saving in terms of infra cost for StackBlitz to deliver this UX, something Codesandbox can't deliver as they build on the server, so they have huge bandwidth use.hence the PR to better balance it.
I noticed a small bug along the way that I reported codesandbox/codesandbox-client#8299.