fix(Sandpack): prevent phantom browser history entries on scroll (#8047)
Fixes #8047
This PR resolves an issue where scrolling down documentation pages (such as “Separating Events from Effects”) caused multiple phantom browser history entries, requiring multiple back button presses to navigate away.
- Ensures Sandpack iframe bundler registers only once per mount.
- Prevents repeated history pushes from iframe reloads.
- Verified locally on Chrome and Firefox.
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 |
110.54 KB (🟡 +1 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!
I think this issue is related to codesandbox/sandpack#992, not react.dev site...