Skip to content

Avoid duplicate sandbox base styles#8556

Open
vivekjm wants to merge 1 commit into
reactjs:mainfrom
vivekjm:fix/tic-tac-toe-sandbox-css
Open

Avoid duplicate sandbox base styles#8556
vivekjm wants to merge 1 commit into
reactjs:mainfrom
vivekjm:fix/tic-tac-toe-sandbox-css

Conversation

@vivekjm

@vivekjm vivekjm commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • avoid prepending the shared Sandpack base stylesheet when an example already includes it
  • keep exported and forked tutorial stylesheets free of duplicate base rules

Why

The Tic-Tac-Toe tutorial includes the same base CSS that SandpackRoot injects. The wrapper appended it a second time, so CodeSandbox downloads contained duplicate * and body rules even though the tutorial source defined them once.

Fixes #8535.

Checks

  • yarn prettier:diff
  • yarn tsc
  • git diff --check

@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 115.15 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!

Five 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 127.56 KB (🟢 -31 B) 242.71 KB
/500 127.57 KB (🟢 -31 B) 242.72 KB
/[[...markdownPath]] 130.01 KB (🟢 -31 B) 245.15 KB
/errors 127.81 KB (🟢 -31 B) 242.96 KB
/errors/[errorCode] 127.79 KB (🟢 -31 B) 242.94 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.

@vivekjm
vivekjm marked this pull request as ready for review July 26, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tic-Tac-Toe sandbox download contains duplicate CSS rules

1 participant