[docs-infra] Improve StackBlitz support #40832
Merged
+48
−48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.