Skip to content

chore: more ssr! - #9260

Open
avivkeller wants to merge 3 commits into
mainfrom
fix/sidebar-mobile-disclosure
Open

avivkeller wants to merge 3 commits into
mainfrom
fix/sidebar-mobile-disclosure

Conversation

@avivkeller

@avivkeller avivkeller commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

(1) Look at https://webpack-doc-kit.vercel.app/docs/api/v5.x and you'll see the issue (speed!)
(2) This change can cascade (with some other similar changes) to make the site a ton smaller using more SSR!

Copilot AI balanced review requested due to automatic review settings November 1, 2026 13:06
@avivkeller
avivkeller requested a review from a team as a code owner November 1, 2026 13:06
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Nov 1, 2026 2:32pm UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.85427% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.81%. Comparing base (53d777b) to head (5d10c1d).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/site/components/Sidebar/index.tsx 74.46% 12 Missing ⚠️
apps/site/providers/detectedOSProvider.tsx 29.41% 12 Missing ⚠️
...ges/ui-components/src/Common/Breadcrumbs/index.tsx 80.00% 10 Missing ⚠️
...rc/Containers/Sidebar/SidebarCollapsible/index.tsx 67.74% 10 Missing ⚠️
...ages/ui-components/src/Containers/NavBar/index.tsx 0.00% 9 Missing ⚠️
apps/site/components/AvatarGroup/index.tsx 66.66% 7 Missing ⚠️
apps/site/components/Sidebar/ScrollRestore.tsx 75.00% 6 Missing ⚠️
apps/site/components/AvatarGroup/Avatars.tsx 66.66% 5 Missing ⚠️
apps/site/components/Downloads/DownloadLink.tsx 28.57% 5 Missing ⚠️
...mmon/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx 54.54% 5 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9260      +/-   ##
==========================================
- Coverage   86.14%   84.81%   -1.33%     
==========================================
  Files          87      108      +21     
  Lines        6164     7152     +988     
  Branches      369      428      +59     
==========================================
+ Hits         5310     6066     +756     
- Misses        850     1078     +228     
- Partials        4        8       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total First Load JS 7.21 MB
New Total First Load JS 6.26 MB
Delta -969.55 KB (-13.13%)

Changes

🔄 Modified Routes (4)
Route Old First Load JS New First Load JS Delta
/[locale] 1.69 MB 1.46 MB 📉 -242.39 KB (-13.97%)
/[locale]/[...path] 1.69 MB 1.46 MB 📉 -242.39 KB (-13.97%)
/[locale]/blog/[...path] 1.69 MB 1.46 MB 📉 -242.39 KB (-13.97%)
/[locale]/download/archive/[version] 1.69 MB 1.46 MB 📉 -242.39 KB (-13.97%)

@avivkeller avivkeller changed the title feat: make the mobile selector less render-heavy chore: more ssr! Nov 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hoiw is this related?

import styles from './index.module.css';

type DownloadButtonProps = { release: NodeRelease };
type DownloadButtonProps = { release: NodeRelease } & Pick<

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this better? Those functions are already SSR.

const release = use(ReleaseContext);
const t = useTranslations();

useEffect(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing this? This was intentional...


const PlatformDropdown: FC = () => {
const { architecture, bitness } = useClientContext();
const { architecture, bitness } = use(DetectedOSContext);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a Hook for the Provider please 🙇

// If there's only a single navigation key, use its sub-items as our navigation
const groups = (
navKeys.length === 1 ? sideNavigation[0].items : sideNavigation
).map(toGroup);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const groupToUse = navKeys.length === 1 ? sideNavigation[0].items : sideNavigation
const groups = groupToUse.map(toGroup);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit ☝️

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual, please, add PR description, explain the changes, how they tie together, add screenshots, if there's any side-effect and confirm that you have tested every single one of these pages and confirmed all sort of behaviors in all sort of scenarios that the previous code held are still working.

It's hard to validate when a PR is touching so many different things seeminlgy not tied together (+ changing styles)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff.

setOpen(localStorage.getItem(STORAGE_KEY) !== banner.text);
}
// eslint-disable-next-line @eslint-react/set-state-in-effect
setOpen(localStorage.getItem(STORAGE_KEY) !== banner.text);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we absoluely avoid breaking the glass within a React component. In this case, Storage APIs, we should use a Hook for reading/writing from Storage.

return label ? [...breadcrumbs, { label, href: link }] : breadcrumbs;
}
// Reduce the path to a breadcrumbs array by finding each segment in the current navigation layer,
// descending into the found node's items (next layer) for the next segment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this fn to an utility file, keeps the component just with the component. Allows you to unit test getBreadcumbs

@@ -51,12 +43,7 @@ const MetaBar: FC = () => {
...(usernames.length && {
[t(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate this t() call to a constant.

const actions = useMemo(() => getActions(dispatch), [dispatch]);

// The detected OS and platform seed the selection once they are known
useEffect(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there were reasons why we left each one of these Hooks contained to the Components that own such functionality. i.e. the OS component has Hooks for OS changes.

I'm unsure it is a good design pattern for a Provider to hold App Logic specific to certain components that use said data, and where said data changes only matter for them...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing the Matter Provider from here? 🤔


import styles from './index.module.css';

const COMPACT_MEDIA_QUERY = '(max-width: 1280px)';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: constants to live in constants files

</BreadcrumbItem>
)}
{isOverflow && <BreadcrumbTruncatedItem />}
{hiddenCount > 0 ? (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this?

[styles.currentDropDown]: code === currentLanguage,
})}
// A plain anchor has no locale to switch to
{...(Component !== 'a' && { locale: code })}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But do we really need... this? What happens if we simply pass locale to a? It becomes a HTML prop right?

This branch was successfully deployed

2 active (1 outdated) deployments
Storybook — 5d10c1dd Deployed Nov 1, 2026 by avivkeller via Chromatic #2371
Preview — 3ed7d66b Deployed Nov 1, 2026 by vercel[bot]
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.

3 participants