Skip to content

perf: hydrate the footer on scroll and mount the logo menu on demand - #2673

Merged
atinux merged 2 commits into
mainfrom
perf/home-hydration
Nov 18, 2026
Merged

atinux merged 2 commits into
mainfrom
perf/home-hydration

Conversation

@atinux

@atinux atinux commented Nov 17, 2026

Copy link
Copy Markdown
Member

Written by an AI agent on behalf of @atinux.

Follow-up to #2672. On load, the homepage hydrates in one long main-thread task, about 880 ms at 4× CPU slowdown, which dominates Total Blocking Time. Hydrating the page meant setting up 740 component instances in that task. Two of them didn't need to be part of it.

What changed

  • Footer (layouts/default.vue): <LazyAppFooter hydrate-on-visible />. The footer's link columns and newsletter form (about 120 component instances) hydrated with the page on load, on every page, though it's below the fold. Its server HTML is unchanged, so links work right away; the newsletter form becomes interactive once it scrolls into view.
  • Logo menu (HeaderLogo.vue): the right-click menu on the logo mounted a closed UDropdownMenu (13 instances) on every page load. It now mounts on the first right-click and opens right away.

After these two changes, 605 component instances hydrate on load instead of 740 (counted from the Vue tree on the homepage, 1280 px wide).

Evidence

Both sides built locally (nuxt build, then node .output/server/index.mjs), main at e02e6bb vs this branch. Homepage, Playwright Chromium, Moto G Power profile, CPU throttled 4×, longest task read from a longtask PerformanceObserver after load plus 5 s. 15 runs each, alternating in batches of 3:

main This PR
Longest task (median) 877 ms 693 ms
Longest task (range) 703 – 1,264 ms 573 – 1,326 ms

One batch on each side ran alongside a Lighthouse job, which is where the 1,100–1,300 ms outliers come from.

Lighthouse 12.6.1 mobile, performance only, same two local builds, 3 runs each:

main This PR
Simulated: score 39, 40, 38 42, 41, 41
Simulated: TBT (median) 669 ms 571 ms
Applied throttling (devtools): score 30, 31, 31 31, 31, 32
Applied throttling: TBT (median) 2,192 ms 2,072 ms

FCP and LCP don't change. Local Lighthouse FCP and LCP read 12–17 s because the orb simulates its slow network against localhost, so only the differences matter.

Checked in the same build, with no console error or hydration warning:

  • Right-clicking the logo still opens its menu (Copy Wordmark, Copy Logo, Download Brand Assets, Brand Guidelines).
  • After scrolling down, the footer has its 14 links and the newsletter form validates ("Please enter a valid email").
Logo menu Footer after scrolling
Logo menu Footer

Details

What's left in the hydration task, and why I didn't change it:

  • Header, about 250 instances. The desktop UNavigationMenu costs about 20 instances per link. Each closed UTooltip costs about 7 (root, trigger, popper) and renders no content. Both are visible and interactive on load.
  • Hero code tabs, about 140 instances. The file tree of the active tab is a reka TreeRoot that users click into. It's above the fold.
  • Agent panel, about 75 instances. It's mounted while closed because the docked sidebar keeps a rail to reopen it.
  • Of the time itself, about 70 ms is Nuxt UI computing class names (tailwind-variants and tailwind-merge). Most of the rest is Vue's own hydration and patching, spread across those components.

Taking the task further means rendering less on load. One option is a lighter header nav or hero tree. Another is to make Nuxt UI's class computation cheaper. Both are bigger changes than this PR.

eslint passes on both files.

ELI5

When the homepage loads, the browser has to wake up every interactive piece of it at once, and that freezes it for close to a second on a slow phone. The footer at the bottom and a hidden right-click menu on the logo no longer wake up until you need them, which takes about a fifth off that freeze.

The footer's link columns and newsletter form (about 120 component
instances) hydrated with the rest of the page in one long task on load,
though they sit below the fold on every page.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1e525-9983-7071-a70a-d5ef82f1ba95
The logo's context menu hydrated a closed dropdown on every page load for
a menu that only opens on right-click.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1e525-9983-7071-a70a-d5ef82f1ba95
@vercel

vercel Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
nuxt Ready Ready Preview Nov 17, 2026 11:38pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The logo dropdown now mounts when its context menu opens. The default layout now renders LazyAppFooter with hydrate-on-visible instead of AppFooter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to 52d97

This change defers footer hydration and logo menu mounting to reduce initial hydration work. No concrete regression has been identified, and it is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changes in the PR: deferring footer hydration and mounting the logo menu on demand. It uses the conventional 'perf:' prefix and matches the changeset and objectives. It is slig…
Description check Passed The description covers the two changes (footer hydrate-on-visible and the logo menu mounting on first right-click). It also gives measurement evidence, scope of remaining hydration work, and verificat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two changes in the PR: deferring footer hydration and mounting the logo menu on demand. It uses the conventional 'perf:' prefix and matches the changeset and objectives. It is slightly long at 68 characters, but it remains specific and accurate.

Full details: Description check

Explanation

The description covers the two changes (footer hydrate-on-visible and the logo menu mounting on first right-click). It also gives measurement evidence, scope of remaining hydration work, and verification steps, all of which relate directly to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

app/components/header/HeaderLogo.vue

Parsing error: Unexpected token {

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bff1ca75-33c0-405a-a055-b983564b0954
Commits

Reviewing files that changed from the base of the PR and between cc03ba5 and 52d9713.

Files selected for processing: 2

  • app/components/header/HeaderLogo.vue
  • app/layouts/default.vue

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@nuxt-com-bundle-report

Copy link
Copy Markdown

Bundle size

Explore the comparison →

Client 1.31 MB $\color{red}\textsf{(+3.35 kB, +0.3}\%\textsf{)}$ · Server 9.15 MB $\color{red}\textsf{(+187.8 kB, +2.1}\%\textsf{)}$

Initial page load PR Δ
/nuxters 379.2 kB +3.25 kB (+0.9%)
/nuxters/:username() 359.5 kB +3.20 kB (+0.9%)
/templates/:slug() 309.1 kB +3.18 kB (+1.0%)
/translations 336.7 kB +3.16 kB (+0.9%)
/modules/:slug()/:path(.) 376.1 kB +3.16 kB (+0.8%)
/modules 375.9 kB +3.16 kB (+0.8%)
/showcase 297.9 kB +3.16 kB (+1.1%)
/team 297.6 kB +3.14 kB (+1.1%)
/templates 316.1 kB +3.14 kB (+1.0%)
/updates 317.3 kB +3.14 kB (+1.0%)

And 330 more routes.

Largest changes in the client
Package or file Base PR Δ
[unassigned] 131.9 kB 133.9 kB +1.92 kB (+1.5%)
node_modules/@nuxt/ui 88.5 kB 89.5 kB +904 B (+1.0%)
.nuxt/ui/input.ts 676 B 921 B +245 B (+36.2%)
Largest changes in the server
Package or file Base PR Δ
[unassigned] 7.63 MB 7.82 MB +186.9 kB (+2.4%)
.nuxt/dist/server/client.precomputed.mjs 16.7 kB 17.1 kB +386 B (+2.3%)
.nuxt/dist/server/_nuxt/index-styles-3.CrpZHZ2t.mjs n/a 120 B +120 B
.nuxt/dist/server/_nuxt/index-styles.DGS8VdLD.mjs 114 B n/a −114 B (−100.0%)
.nuxt/dist/server/_nuxt/HomeLogoCarousel-styles.CqAq9vtA.mjs n/a 91 B +91 B
.nuxt/dist/server/_nuxt/HomeSectionContributors-styles.DgmGiqMI.mjs n/a 88 B +88 B
.nuxt/dist/server/_nuxt/index-styles-3.DVlUY7W2.mjs 85 B n/a −85 B (−100.0%)
.nuxt/dist/server/_nuxt/slug-styles.DM6jAnhr.mjs n/a 84 B +84 B
.nuxt/dist/server/_nuxt/slug-styles.CVjTbRKd.mjs 82 B n/a −82 B (−100.0%)
.nuxt/dist/server/_nuxt/index-styles-2.DYWmvYiZ.mjs n/a 81 B +81 B

And 6 more packages or files.

Brotli sizes. Changes under 100 B are left out of the tables. Initial page load counts the JavaScript and CSS a route loads before it renders. Measured by nuxt-bundle-analyzer for 52d9713.

@atinux
atinux merged commit 04aadf3 into main Nov 18, 2026
18 checks passed
@atinux
atinux deleted the perf/home-hydration branch November 18, 2026 09:13

This branch was successfully deployed

1 active deployment
Preview — 52d97137 Deployed Nov 17, 2026 by vercel[bot] via e2e #10318
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.

1 participant