Make home, /teams and 404 lighter without changing what they show - #118
Merged
willwashburn merged 2 commits intoSep 23, 2026
Merged
Conversation
- Render the lobehub marks these pages use from server-safe copies (components/brand-icons.tsx). Every @lobehub/icons module is 'use client' and its default export pulls in emoji data, ~145 KB of JS per page. A parity test checks the markup matches lobehub exactly. - Lazy-load the 404 backdrop through a next/dynamic client wrapper. The root not-found boundary is part of every route, so its terminal code was in every page's bundle; it still server-renders on a real 404. - Load the hero investor logos eagerly and unoptimized so they no longer pop in after layout. - Serve display-sized WebP copies of the /teams avatars and concept screenshots (scripts/generate-web-images.mjs). Production has no Cloudflare IMAGES binding, so /_next/image returned the 150-800 KB originals. - Pause the timer-driven previews while offscreen (useOnScreen) and replace the chat preview's 250 ms visibility poll with an IntersectionObserver. - Move the docs star badge into its own module so pages with the plain badge don't bundle its client component and the docs nav. - Remove unused CSS-module rules from landing, flows, teams-landing, site-nav and enterprise styles, and the unused AgentSetupPrompt component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
Contributor
|
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
The inline Yonder SVG had only a viewBox, so it took its size (and green colour) entirely from investor-strip.module.css. When a client navigation to home painted before that stylesheet loaded (e.g. from the 404, which doesn't carry it), the mark rendered at the full viewport width in white. Give it the same 25px intrinsic size the stylesheet applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
willwashburn
deleted the
claude/homepage-performance-optimization-7f2b16
branch
September 23, 2026 16:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Performance and cleanup for the homepage, /teams and the 404 page. There are no copy or visual changes: the built HTML of all three pages matches
mainapart from the intended image attributes and sources, and the 404 output is identical.@lobehub/iconsmodules are all'use client', and each default export attaches Avatar/Combine variants that pull in emoji data. That shipped about 145 KB of JS to every page just to draw a few logos.components/brand-icons.tsxrenders the same SVG on the server;lib/test/brand-icons.test.tsxasserts the markup is identical to lobehub's, including gradient ids.app/not-found/LostFieldLazy.tsxwraps it innext/dynamic: it still server-renders on a real 404, but its chunk only downloads there. Server-rendering it instead was tried and rejected, because Next serializes the root not-found tree into every page's RSC payload, which added about 220 KB of HTML per page.loading="lazy"in the hero, and the WebP also went through/_next/image. They now load eagerly and unoptimized.IMAGESbinding, so OpenNext's/_next/imagereturns the original file: 24px avatars were downloading 150–800 KB PNGs.scripts/generate-web-images.mjswrites 128px WebP avatars and q90 WebP screenshots, which look the same when zoomed. /teams image weight in and below the hero drops from about 4.7 MB to about 225 KB.components/useOnScreen.ts). The chat preview's 250 ms visibility poll and scroll listeners are replaced by oneIntersectionObserverwith the same trigger band.DocsGitHubStarsBadgeServer.tsx, so pages showing only the plain badge no longer bundle its client component and the docs nav.landing,flows,teams-landing,site-navandenterprise. A check confirmed every remaining rule is unchanged and in the same order. The unusedAgentSetupPromptcomponent is removed too.Numbers
Per-page download compared with
main: brotli-compressed HTML + JS + CSS, excluding thenoModulepolyfills; the build had a PostHog key set, as in prod.Reviewer notes
tscclean and the production build passes. In the browser I checked that the animations pause and resume, the chat preview starts on scroll, and the 404 terminals and click bursts work.lib/test/flow-push-guard.test.tstimes out under the full parallelvitestrun; it's an existing issue in untouched code and passes 18/18 on its own.IMAGESbinding would fix image sizing site-wide, but it's an infra change behind thecmogate.🤖 Generated with Claude Code
Note
Low Risk
Marketing-site performance and dead-code removal; one minor UX note is 404 terminals appearing slightly later on client-side navigation while the lazy chunk loads.
Overview
Performance-focused cleanup for the homepage,
/teams, and 404: smaller downloads and less main-thread work, with no intended visual or copy changes.Bundle and hydration: Marketing logos move from
@lobehub/icons(client-only, ~145 KB) to server-renderedbrand-icons.tsxwith parity tests. The 404LostFieldbackdrop isnext/dynamicso its chunk is not on every route. Docs star badge logic is split intoDocsGitHubStarsBadgeServer.tsxso non-docs pages avoid the docs nav client bundle.Runtime: Landing previews (search typing, realtime feed, delivery timeline, workflow trace) gate timers on
useOnScreenso they pause off-screen and resume in place.ChannelMessagesPreviewdrops scroll polling for a singleIntersectionObserver.Assets: Investor logos load eager/unoptimized; hero avatars and team screenshots use generated WebP (
generate-web-images.mjs) withunoptimizedwhere/_next/imagewould serve full originals. Author/contact images point at-128.webpvariants.Removal: Unused CSS across landing/flows/teams/nav/enterprise modules, unused
AgentSetupPromptand related styles, and split ofGitHubStarsdocs export.Reviewed by Cursor Bugbot for commit 99d173a. Bugbot is set up for automated code reviews on this repo. Configure here.