Skip to content
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

Sandpack 2.0: upgrade playgrounds #5917

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

danilowoz
Copy link
Contributor

@danilowoz danilowoz commented Apr 12, 2023

This upgrads Sandpack to version 2.0, which brings many fixes and introduces Nodebox. Nodebox will enable us to run RSC in the future. As a part of this upgrade, I have also removed some elements, including unnecessary things, such as:

  • No more necessaries patches to fix an issue on CodeMirror syntax-highlight;
  • Legacy code, such as React Devtools components (we can include later, if necessary), Sandpack preview React refs;
  • Use a new approach to consume unstyled/bare Sandpack components;

@github-actions
Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 93.68 KB (🟡 +58 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 75.76 KB (🟡 +2 B) 169.44 KB
/500 75.75 KB (🟡 +2 B) 169.44 KB
/[[...markdownPath]] 77.18 KB (🟡 +2 B) 170.86 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@github-actions
Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 93.67 KB (🟡 +38 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 75.76 KB (🟡 +2 B) 169.42 KB
/500 75.75 KB (🟡 +2 B) 169.42 KB
/[[...markdownPath]] 77.18 KB (🟡 +2 B) 170.84 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@github-actions
Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 93.67 KB (🟡 +38 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 75.76 KB (🟡 +2 B) 169.42 KB
/500 75.75 KB (🟡 +2 B) 169.42 KB
/[[...markdownPath]] 77.18 KB (🟡 +2 B) 170.84 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@danilowoz danilowoz marked this pull request as ready for review April 12, 2023 23:36
@danilowoz
Copy link
Contributor Author

@harish-sethuraman, can I count on you to review this PR? Things to pay attention to:

  • Syntax-highlight on the code editor: it should have a different syntax between HTML tabs and react components;
  • General sandboxes layout structure;
  • Decorators on the code snippets on API reference pages
  • Inline syntax error: make sure they appear correct, and they are gone when fixed
  • Reset code button

@harish-sethuraman
Copy link
Collaborator

I started to test and then this happened when I typed long text and also the horizontal scroll is also gone
Screenshot 2023-04-13 at 8 15 32 PM

@danilowoz danilowoz force-pushed the draft/awesome-kilby branch from 8446551 to bb0e431 Compare May 3, 2023 18:09
@danilowoz
Copy link
Contributor Author

danilowoz commented May 3, 2023

Hey @harish-sethuraman, thanks for reviewing.

CodeMirror changed how they handle the scroll, so it needed to do a few tweaks. Can you check it again?
Hope we can get this merged soon. I was out for a couple of weeks, but I promise to be more responsive now

@github-actions
Copy link

github-actions bot commented May 3, 2023

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 103.95 KB (🟡 +2 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 76.94 KB (🟡 +5 B) 180.89 KB
/500 76.93 KB (🟡 +5 B) 180.88 KB
/[[...markdownPath]] 78.41 KB (🟡 +5 B) 182.36 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@kmiddleton14
Copy link
Contributor

Thanks @danilowoz for this change! Could you update to the latest version and resolve the merge conflicts?

@danilowoz
Copy link
Contributor Author

@kmiddleton14, updated! I walked through some pages testing all the sandboxes, and everything looks good

@lunaleaps
Copy link
Contributor

Thanks @danilowoz for this!

My testing is also looking good! Tried out mobile. There are some issues forking the CodeSandbox when using an in-app browser but that seems consistent with current react.dev

Another thing I noticed.. which I can't reproduce anymore.. is that the "Show More/Less" ends up in the wrong place.
CleanShot 2023-09-08 at 10 25 22@2x

I've been trying to get it to reproduce with window resizing and expanding but it might've just been a fluke 🤷‍♀️

Otherwise this looks good to me!

@kmiddleton14 kmiddleton14 merged commit 43ada1f into reactjs:main Sep 12, 2023
3 checks passed
@danilowoz danilowoz deleted the draft/awesome-kilby branch September 12, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants